Analyze bundle size

#1

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.

#2

Hi
Did you find a solution ?

#3

Yes I use this: https://github.com/danvk/source-map-explorer

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

#4

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

1 Like
#5

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

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

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