2

I see few posts to reduce vendor.js file size in different angular versions. i.e. 2,4,6,7 but couldn't find any information specifically for Angular 8.

My Vendor.js file version is 10MB on initially project creation and due to that it is taking longer time to load production version. Is there a way to reduce this size?

Per my knowledge, I enable compression in angular.js file but no luck. My project is build using .net core 3.1.

1 Answer 1

2

Please consider using ng build -prod -aot -vc -cc -dop --buildOptimizer to perform all the optimizations Angular provides. Note the -vc flag is meaning "vendor chunck" then your vendor will be splited into smallest chunck and be loaded in parallel by the client browser.

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

6 Comments

building project with this command reduce the bundle files but at the same time it is adding some random digits within filename. i.e. main.52ff59cbd141cff8ee1c.js. For me, this is issue as we are loading Angular within MVC application, I can not give exact script name to load inside my MVC application. Any suggestion for fix filename?
"namedChunks": true,in your angular.json configuration should do the job
that's not working, still creating file with random ids.
Try to add —output-hashing=false
--vendor-chunk is not recommended for production build as official documentation states
|

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.