The wrong styles bundle path

2019-05-18 09:03发布

问题:

I have a angular 4 app with angular-cli aot, and I build the prod version on azure web app
I noticed that on some pages styles bundle try to find it by relative path
As result I see next error in console:

GET http://example.com/en/styles.b0bf326c21a7f4ee7e7f.bundle.css net::ERR_ABORTED

in the html I see that css doesn't start from "/":

<link href="styles.b0bf326c21a7f4ee7e7f.bundle.css" rel="stylesheet">

How I can fix that?

Thanks

回答1:

Found the solution here

--deploy-url (aliases: -d)

URL where files will be deployed.

node ./node_modules/@angular/cli/bin/ng build --prod --deploy-url /