full-fledged / alerts

MIT License
7 stars 0 forks source link

Large bundle size #3

Open btxtiger opened 2 years ago

btxtiger commented 2 years ago

I was wondering that the alerts seem to take such a large part in the generated bundle of my project. I looked through the source but it looked very clean for me, despite there are some unused packages in package.json (bootstrap, jquery, ...). Also core-js is not required anymore as explicit package with Angular 13.

Maybe you can check what creates this large bundle using ng build --stats-json and using "webpack-bundle-analyzer": "^4.5.0" with webpack-bundle-analyzer dist/alerts/stats.json. I would expect the library to have < 30kb.

You can temporary set in the angular.json

"configurations": {
   "production": {
      "namedChunks": true

to get more qualified bundle names. I'm also having a look if I get some time.

image

btxtiger commented 2 years ago

Turned out the two png icons were increasing the component size by 239kb. I would appreciate to use SVG icons instead, for example by using @fortawesome/angular-fontawesome and @fortawesome/fontawesome-svg-core, which also allow tree shaking. If you confirm I can create a PR for implementation.

image

image

image