9

I hope to get more answers here :) (open issue in angular-cli as well)

as of angular 13, it says that deployUrl is being deprecated.

in our project, we define deployUrl (in angular.json) as our CDN address, which is then added to all the images and scripts (in index.html and CSS files). This allows us to load our assets from our CDN, while sending the HTTP requests to our server (the domain that we ran at, while baseHref is '/').

Setting the baseHref to be the CDN domain (without deployUrl) causes our app to send all of the HTTP requests to the CDN instead of to our domain - which breaks the app.

Once deployUrl is deprecated, how can we keep having the CDN defined (like publicPath in WebPack) without breaking the app's HTTP requests?

spinker
  • 298
  • 4
  • 20

1 Answers1

0

I had a similar issue after I upgraded from v8 to v13 and had to switch to the APP_BASE_HREF and add in a servepath variable into my angular.json. The other option that when you build with the --serve-path and --public-host parameter into your serve command, documentation can be found here https://docs.w3cub.com/angular/cli/serve. You may also need to use the proxy parameter for your CDN

As for the reasoning behind this change I'm not entirely sure as they say in their documentation "This means specifying a deploy url will decrease build speed, but this is the unfortunate cost of using an option that embeds itself throughout an application. That is why a base href is generally the better option." Which I don't really see as a downside...but I don't work for Google

Dharman
  • 30,962
  • 25
  • 85
  • 135