angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

vendor.********.bundle.js size is too large in production

Open AungMyoKyaw opened this issue 9 years ago • 29 comments

OS?

Mac OSX (Yosemite)

Versions.

1.0.0-beta.24

My App Repo

https://github.com/AungMyoKyaw/NightlifeCoordinationApp

ng build --prod --aot vendor.**.bundle.js size is still too large. angular-cli compress this file for production but it does not remove comment. is there options for this ? please

AungMyoKyaw avatar Jan 17 '17 04:01 AungMyoKyaw

angular 5 and their cli create much smaller files, although in my case it took more time to build but the size was really small (even no vendor created anymore).

maapteh avatar Nov 16 '17 14:11 maapteh

Try this out:

ng build -prod -aot --buildOptimizer

pacurtin avatar Dec 11 '17 04:12 pacurtin

@pacurtin @maapteh @hansl @deebloo My vendor bundle.js is 3.45 MB. How can i reduce it to keep under 2 MB.

I've used - ng build -prod -aot --buildOptimizer

👍 1

arunprasathv avatar Feb 28 '18 16:02 arunprasathv

1: Don't use unnecessary imports 2: Keep track the size of the modules, 3: ng build -prod -aot --buildOptimizer like the @pacurtin say ^^ 4: I am not sure about the comments but inline SVG can increase the size

ghost avatar Feb 28 '18 17:02 ghost

Just a quick note: ng build --prod is equivalent to ng build --prod --aot --buildOptimizer Also, ng build --prod does not generate a vendor bundle by default.

clydin avatar Feb 28 '18 17:02 clydin

Any luck in 2018 guys ? I am getting vector bundle of 3MB even after ng build --prod --aot --buildOptimizer (seems to be similar to ng build --prod). My site is too slow !

dssagar93 avatar Nov 15 '18 11:11 dssagar93

@dssagar93 If your site is slow in production try something like https://www.webpagetest.org/ and make sure your server has gzip enabled.

With gzip enabled my main.js went from 5.5mb to 1.4mb

I'm also going to try splitting my app into sub modules as detailed here: https://malcoded.com/posts/angular-fundamentals-modules

That way users will lazy-load some parts of my app and won't have such a big download when all they really need to see at first is a login page or a home page.

pacurtin avatar Nov 16 '18 00:11 pacurtin

I have GZIP already enabled. I don't know what is causing the issue. When I check the network tab in Chrome dev tools there is a long idle time of around 8 seconds while loading the site. I dont understand what that idle time is for !

dssagar93 avatar Nov 16 '18 05:11 dssagar93

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.