3

I'm having issues as I serve my javascript files from a CDN. IN new angular cli (v7) when I enable lazy loading the generated chunk files are loaded from the root directory by default, however I want them to be served from a different url (s3 in this case).

How it is being loaded:

...
http://<website_url>/polyfills.js
http://<website_url>/runtime.js
http://<website_url>/main.js
...

How I want it to load:

...
http://<website_url>/abolutepath/polyfills.js
http://<website_url>/abolutepath/runtime.js
http://<website_url>/abolutepath/main.js
...

Just to mention I have tried base href and it doesn't work. It still loads the chunk fiels from root.

<base href="/abolutepath/">
arbghl
  • 358
  • 2
  • 14

1 Answers1

3

You can specify --deployUrl when using build

ng build --prod --deployUrl http://<website_url>/abolutepath

Basically this is when you upload files into custom folder + if want to use CDN

Vova Bilyachat
  • 18,765
  • 4
  • 55
  • 80