Webpack-bundle-analyzer: Remove node_modules from report and stats file

Created on 24 Jul 2018  路  3Comments  路  Source: webpack-contrib/webpack-bundle-analyzer

Remove node_modules from report and stats file

So, I need to generate a report and stats file containing only source files and no node_modules/vendor/third party. Tried that from both excludeAssets and exclude array within statOptions but no luck. How can one accomplish that? Thanks in advance!

Technical info

  • Webpack Bundle Analyzer version: ^2.13.1
  • Webpack version: 2.7.0
  • Node.js version: 8.9.3
  • npm/yarn version: 5.5.3
  • OS: MacOS Sierra 10.12.6

Debug info

How do you use this module? As CLI utility or as plugin?

Plugin

new BundleAnalyzerPlugin({
    excludeAssets: ['node_modules', 'dev', 'vendor'],
    generateStatsFile: true,
    statsOptions: {
      exclude: ['node_modules', 'dev', 'vendor'],
      hash: false,
      cached: false,
      cachedAssets: false,
      reasons: false,
      source: true,
      warnings: false,
      errors: false,
      errorDetails: false,
      publicPath: false,
      modulesSort: 'size',
      chunksSort: 'size',
      assetsSort: 'size'
    }
})

What other Webpack plugins were used?

None

Feature

Most helpful comment

{
  statsOptions: {
    exclude: /node_modules/
  }
}

works for me.

All 3 comments

{
  statsOptions: {
    exclude: /node_modules/
  }
}

works for me.

{
  statsOptions: {
    exclude: /node_modules/
  }
}

works for me.

also work for me

Great! Then this is resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muuvmuuv picture muuvmuuv  路  3Comments

vytautas-pranskunas- picture vytautas-pranskunas-  路  8Comments

Chris2011 picture Chris2011  路  4Comments

zverexe picture zverexe  路  5Comments

deanshub picture deanshub  路  6Comments