question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng build --prod --base-href includes absolute path of building cwd

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Windows 10, GIt Bash

$ ng --version

Angular CLI: 6.2.3
Node: 8.12.0
OS: win32 x64
Angular: 6.1.8

Repro steps

Build project by the following command:

ng build --prod --base-href /client1-app

The log given by the failure

n/a

Desired functionality

Application need to be deployed under http://example.com/client1-app. The base path for it should be /client1-app then.

However in index.html wrong base path is included:

$ grep base dist/election-barometer/index.html
  <base href="E:/Programs/Git/client1-app">

The git installation path (absolute path of installation dir) is included when --base-href starts with slash character.

Base href cannot be just client1-app (without slash at the beggining), because of routing. User can start application from: /client1-app/some/path/started Then, client1-app will point to example.com/some/path/client1-app Which is not intended, so slash at the beggining is required.

Mention any other details that might be useful

The following repository could be useful during investigation: https://github.com/athlan/election-barometer However, nothing special on it, was generated by ng cli.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
simjescommented, Oct 7, 2018

Noticed this as well, but only happened when using bash. Seems to work as expected in PowerShell.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 8, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 4: Use of base-href and deploy-url build options
I use Angular 4 at work for building a single page application. Today, I faced the problem where I had to use different...
Read more >
ng build --prod --base-href - Stack Overflow
My app runs but the icons which are in assets are not picking correct path so they do not show on the web...
Read more >
serve-path=<path> --base-href <path>/ with the ... - Medium
Run ng serve --serve-path= --base-href / with the same settings ... This is something that otherwise can be in the build/deploy pipeline.
Read more >
Build configuration for Azure Static Web Apps - Microsoft Learn
Set the value to true to skip building the API functions. No. cwd (Azure Pipelines only), Absolute path to the working folder. Defaults...
Read more >
public-host, Ng build --base-href, Deploy Angular 6 to apache ...
Closed ng build --prod --base-href includes absolute path of building cwd , Find Deals on Neutrogena Build in Skin Care on Amazon. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found