angular baseHref no impact on index.html links

Viewed 392

In angular I used to run my build command with the --base-href \myapp syntax.

Now I updated to angular 13 and this command line property is not anymore available. So I added the property to angular.json: ...configurations/"test"/baseHref: "\myapp"

But this seems to be not enough. This setting will add a <base href="/myapp"> in the index.html head tag. But it will not change the other links in index.html like:

<link rel="stylesheet" href="styles.5fe3fd16ea7e146e.css">

So at runtime i get a 404 because styles....css cannot be found in the root, but should reference "myapp/styles....css".

Where can I set baseHref so it also affects the links in index.html?

1 Answers

It seems that the command line parameter 'base-href' needs to be replaced with the two properties 'baseHref' and 'deployUrl' in angular.json.

Related