Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decrease size of vendor.js in angular 2,4,6,7,8,9,10?

Angular CLI creates vendor.js and I don't know Why and What is the use of it?? Size of this file is about 3.2MB for a new app!!

Does this file contains Angular 6 Javascript Source?

Don't you think this is big file for loading on internet on low speed connections?

like image 315
Mohamad Shiralizadeh Avatar asked Jul 10 '18 05:07

Mohamad Shiralizadeh


People also ask

Why is my Angular app so big?

Angular is a very opinionated and robust framework. As a result, Angular apps generally have bigger bundle sizes when compared to apps written using other JavaScript frameworks like React. The Angular framework comes with a lot of useful libraries already included within it, such as RxJs and Zone.

What is vendor JS in Angular?

vendor. js : third-party code that your application depends on. polyfills. js : polyfills that allow using newer features in older environments (e.g., using Angular on outdated Web browsers)

What is a good bundle size Angular?

I checked many apps built with Angular and have a feeling that most medium size enterprise apps should have main. *. js under 500 KB, on average 250KB. If your bundle size largely exceed those numbers, you may need to be aware.

What is runtime JS in Angular?

runtime.js is the webpack loader. This file contains webpack utilities that are needed to load other files. styles.css contains all styles we declare in styles section of angular.json file "styles": [ "src/styles.css", "src/my-custom.css"


1 Answers

This file includes all libraries that you added into your project. If you build your app on production mode the file size will be smaller.

ng build --prod 
like image 102
molikh Avatar answered Sep 20 '22 07:09

molikh