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.

Angular-cli 6 and base-href no longer supported?

See original GitHub issue

Versions

Angular CLI: 6.0.0-rc.5
Node: 9.11.1
OS: win32 x64
Angular: 6.0.0-rc.5
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.5.7
@angular-devkit/build-angular     0.5.7
@angular-devkit/build-optimizer   0.5.7
@angular-devkit/core              0.5.7
@angular-devkit/schematics        0.5.7
@ngtools/json-schema              1.1.0
@ngtools/webpack                  6.0.0-rc.5
@schematics/angular               0.5.7
@schematics/update                0.5.7
rxjs                              6.0.0-uncanny-rc.7
typescript                        2.7.2
webpack                           4.5.0

Repro steps

  • change index.html e.g. to base href=“/v2”
  • ng serve -bh /v2/ or ng serve --base-href /v2/
  • in angular.json: “styles”: [“node_modules/[at]fortawesome/fontawesome-free-webfonts/scss/fontawesome.scss”,…

Observed behavior

option -bh or --base-href is no longer supported
without this option e.g. fonts will not be loaded correctly if a link including the base-href is loaded in the browser:
GET http://localhost:4200/v2/fa-solid-900.woff net::ERR_ABORTED
if i type just "http://localhost:4200" without any base-href it will redirect to /v2 but the ressources will be loaded.

Desired behavior

What is the alternative implementation in angular6?

Issue Analytics

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

github_iconTop GitHub Comments

77reactions
ghostcommented, Apr 24, 2018

hi thanks for you hint. the servepath doesn’t helped here but i found now a way to fix the problem by adding this to angular.json:

      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "baseHref" : "/v2/",
            "deployUrl": "/v2/",

i had to add baseHref and deployUrl instead of just base-href like in angular5

7reactions
alan-agius4commented, Dec 14, 2018

I’m sorry, but we can’t reproduce the problem following the instructions you provided. Remember that we have a large number of issues to resolve, and have only a limited amount of time to reproduce your issue. Short, explicit instructions make it much more likely we’ll be able to reproduce the problem so we can fix it.

If the problem persists, please open a new issue following our submission guidelines.

A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown option: '--base-href' Angular 13 ng serve
im creating an angular 13app using CLI i want ...
Read more >
APP_BASE_HREF - Angular
The base href is the URL prefix that should be preserved when generating and recognizing URLs. const APP_BASE_HREF: InjectionToken<string> ...
Read more >
base href angular - Efficient User
Posts about base href angular written by Pandiyan Murugan. ... The flow is we are going to generate an angular app using angular...
Read more >
How To Update Angular CLI To Latest Version
As local packages have more priority than global packages you will get Your global Angular CLI version is greater than your local version.The ......
Read more >
Angular CLI v11.0.0-rc.0 Release - GitClear
<h3> @ngtools/webpack: remove support for TypeScript 3.9 (<a href="https://github.com/angular/angular-cli/commit/ ...
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