Analyze bundle size

I would like to analyze my main.js bundle to see if I can reduce its size, since its over 3MB even after building it with aot.
How can I do this?
Can I use something like webpack-bundle-analyzer ? If yes, how? I already tried it but I could not find a webpack.config.js in my Ionic project.
Thanks in advance.

Did you find a solution ?

Yes I use this:

You just need to enable sourcemap generation in your package.json

Yep, example of how to build prod with sourcemaps activated:

1 Like

We can also replace that whole line with the following as well

npx source-map-explorer www/build/main.js www/build/

npx does other smart stuff as well, but here it will automagically find the local package.

1 Like