Vue-loader: My app.js is 9 MB. How do I analyze the bundle size?

Created on 17 May 2016  路  9Comments  路  Source: vuejs/vue-loader

Is it possible to analyze the bundle size when running npm run dev?

Most helpful comment

Solved it.

webpack(webpackConfig, function (err, stats) {
  fs.writeFileSync('./stats.json', JSON.stringify(stats.toJson()));
  ...

All 9 comments

The production build size should be different from dev bundle size, I don't think analyzing dev bundle is useful. Why not disable minification for the production build and see what's included in the bundle?

Thanks, that was fast. How would I disable the minification?

I think I got it.

Sorry, I'm completely lost. I tried disabling various options, but no luck.

I will need more information - are you using a template from vue-cli?

Yes, the full fledged webpack template.

I was looking at this, but had no idea how to implement it.
https://github.com/robertknight/webpack-bundle-size-analyzer

Are you saying the resulting js from npm run build is 9MB?

No, the js alone is about 2 MB.

Solved it.

webpack(webpackConfig, function (err, stats) {
  fs.writeFileSync('./stats.json', JSON.stringify(stats.toJson()));
  ...
Was this page helpful?
0 / 5 - 0 ratings