Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Common size of basic app production bundle

I'm trying to build my first Angular 6 app for production, and the build size is around 1 MB.

Because of lack of the experience, it is hard for me to estimate what size it should be, but 1 MB seems to big for relatively small app.

How such an issue can be inspected?

like image 420
Unknwn Artist Avatar asked Jun 18 '18 08:06

Unknwn Artist


People also ask

What is a good JS bundle size?

We recommend restricting pages to a maximum of < 300kb of script (compressed). Where possible, use code splitting to break up your code into small chunks of 50KB or less. That way, browsers can download JS resources in parallel, making full use of HTTP 2 multiplexing.

How to check bundle size in Angular?

By running ng build --prod you will see the bundles size of the files the browser would get from your server.


1 Answers

You can analyze your bundle size with webpack-bundle-analyzer.

If you're using Angular Cli, then you can build your project with ng build --prod --stats-json and it will create a stats.json file inside your dist folder.

Then you can run webpack-bundle-analyzer dist/stats.json and it will show you the problematic areas.

like image 60
k.s. Avatar answered Sep 20 '22 16:09

k.s.