Analyze bundle size

webpack has a feature --json which can be used together with this tool here to analyze the bundle size: https://github.com/robertknight/webpack-bundle-size-analyzer

it can give you a estimation what contributes to the size of your bundle.

Does anyone know a similar approach for meteor?

Created this few months ago using babel parser. It basically reads bundle.js (you can find it in output directory of meteor build, for example bundle/programs/web.browser/7ef4da821810d29babd2ce1844563aa0a3032784.js) file and outputs output.json file with stats.

I cannot guarantee it still works but I was able to find some heavy dependencies some time ago. It only provides stats for meteor packages not npm modules.

1 Like

cool, thx!

But i in fact would need it for npm packages :wink: but still helpful!

I use source-map-explorer:

npm i -g source-map-explorer

And for analysis:

source-map-explorer .meteor/local/build/programs/web.browser/app/app.js{,.map}
3 Likes

thx, @pierreeric, that’s pretty awesome! Do you know how to include node_modules as well?

Currently Meteor doesn’t generate sourcemaps for NPM: https://github.com/meteor/meteor/issues/6715