Reputation: 3289
I tried a few Angular 2 seed projects that use WebPack. When I build the bundle to release it to Prod, I end up with a file of about 3MB.
How could I reduce the size of this file?
One such project is: https://github.com/mgechev/angular-seed
Upvotes: 2
Views: 1435
Reputation: 229
There are some important things how to reduce your bundle size:
Try to use lazyLoading. This will be great to reduce the main bundle size, and it will split as a chunk files.
Refer to this document : https://angular.io/guide/router
remove the unwanted Packages.
Example:
if you want to use the boostrap modal
module, you can import it like this import {modalModule} from ngx-boostrap/modal
Upvotes: 0
Reputation: 755
I don't think the project you provided use webpack.
If you are just looking for a seed project, you can checkout angular-cli. ng build --target=production
do a pretty good production build.
If you are using webpack now, one thing you can check is the devtool
in your webpack config, make sure it is not eval
. Use source-map
may help.
Upvotes: 2
Reputation: 15279
Minimum size with Webpack is around 800kb for empty application, i suspect you are doing something wrong. Source maps are optional.
Upvotes: 1