Skip to content

ng build base-href issue (angular cli 8) #14587

Closed
@Mek89

Description

@Mek89

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Yes, works with angular: 7.2.0

Description

The base-href flag works differently in angular 8. I hope you can help.

In angular 7:
ng build --prod app1 --base-href /app1/

after the command all my relative path in the scss are changed to the proper one.
source:
.example { background: url('/assets/img/picture.png') no-repeat center center; }
deployed:
.example { background: url('/app1/assets/img/picture.png') no-repeat center center; }

With angular 8 nothing happen:
source:
.example { background: url('/assets/img/picture.png') no-repeat center center; }
deployed:
.example { background: url('/assets/img/picture.png') no-repeat center center; }

🔬 Minimal Reproduction

-- get angular-cli 8.0.0 and create a new app (with scss)

npm install -g @angular/cli
ng new my-dream-app

-- add a new class to the css (src/style.scss)
.example { background: url('/assets/img/picture.png') no-repeat center center; }

-- add a new class to a html file (src/app/app.compontent.html)
<div class="example" style="text-align:center">

-- run the build
ng build --prod --base-href /app1/

🔥 Exception or Error

no exception

🌍 Your Environment

Angular CLI: 8.0.0
Node: 10.16.0
OS: win32 x64
Angular: 8.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0
@angular-devkit/build-angular     0.800.0
@angular-devkit/build-optimizer   0.800.0
@angular-devkit/build-webpack     0.800.0
@angular-devkit/core              8.0.0
@angular-devkit/schematics        8.0.0
@ngtools/webpack                  8.0.0
@schematics/angular               8.0.0
@schematics/update                0.800.0
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?
no

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions