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?
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.
By running ng build --prod you will see the bundles size of the files the browser would get from your server.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With