0

I developed a project on angular 5.2.6., but problem is that when I load the application, it takes almost 20-30 seconds.

When I check in the network tab in the browser, I saw that vendor file is taking time because of is size(11.6 Mb).

I want to know that is there any way to minimize that vendor file and what kind of code are packed inside vendor file. I got this link but not get the solution.

How can I minimize that vendor file to load my application faster?

grizzthedj
  • 7,131
  • 16
  • 42
  • 62
Irshad
  • 35
  • 2
  • 7
  • Possible duplicate of [Angular2 CLI huge vendor bundle: how to improve size for prod?](https://stackoverflow.com/questions/41432673/angular2-cli-huge-vendor-bundle-how-to-improve-size-for-prod) – David Apr 02 '18 at 13:13

1 Answers1

1

In Addition to @Brk's answer, there are multiple things you can do ontop of that to minimise the load time of your vendor.bundle.js or other files :

  1. Minification using UglifyJs : It removes all the white spaces and comments. Estimated size reduction is 40-50%.
  2. Configuring your Server to send your JS/Html or any files by automatically compressing them in gzip format. Browser automatically unpacks it and uses your Js files as intended.

If you do these 2 your load time would decrease by 80%.

I did the same , my vendor.bundle.js went from 8 MB to 600 KB.

UGLIFYJS :

uglifyjs dist/vendor.bundle.js --screw-ie8 --compress --mangle --output dist/vendor.bundle.js

Note : You can download uglifyjs using npm

Aakash Uniyal
  • 1,519
  • 4
  • 17
  • 32