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/">

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that solves it. I read somewhere that angular CLI 7 doesn't support deployUrl params (obviously incorrect)
Yep, my bad, was in a hurry so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.