How to use the BundleAnalyzerPlugin function from webpack-bundle-analyzer

Find comprehensive JavaScript webpack-bundle-analyzer.BundleAnalyzerPlugin code examples handpicked from public code repositorys.

26
27
28
29
30
31
32
33
34
35
36
        process: 'process/browser.js',
        Buffer: ['buffer', 'Buffer'],
    }),
];
if (bundleStats) {
    plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static' }));
}


if (!buildConfig.__SSR__ && buildConfig.__DEV__) {
    const dotenv = require('dotenv-safe').config({
fork icon25
star icon47
watch icon6

+ 4 other calls in file

240
241
242
243
244
245
246
247
248
249
new CopyWebpackPlugin({
  patterns: [
    { from: 'static', to: outDir, globOptions: { ignore: ['.*'] } }
  ]
}), // ignore dot (hidden) files
...when(analyze, new BundleAnalyzerPlugin()),
/**
 * Note that the usage of following plugin cleans the webpack output directory before build.
 * In case you want to generate any file in the output path as a part of pre-build step, this plugin will likely
 * remove those before the webpack build. In that case consider disabling the plugin, and instead use something like
fork icon1
star icon0
watch icon1

+ 3 other calls in file

194
195
196
197
198
199
200
201
202
203
if (process.env.NODE_ENV === 'development') {
  plugins.push(new webpack.HotModuleReplacementPlugin());
} else {
  if (debugPath) {
    plugins.push(
      new BundleAnalyzerPlugin({
        analyzerMode: 'disabled',
        openAnalyzer: false,
        generateStatsFile: true,
        statsFilename: path.join(debugPath, 'stats.json'),
fork icon0
star icon1
watch icon3

+ 4 other calls in file

43
44
45
46
47
48
49
50
51
52
53
function getBundleAnalyzerPlugin(analyzeBundle, name) {
    if (!analyzeBundle) {
        return [];
    }


    return [ new BundleAnalyzerPlugin({
        analyzerMode: 'disabled',
        generateStatsFile: true,
        statsFilename: `${name}-stats.json`
    }) ];
fork icon0
star icon0
watch icon1

+ 3 other calls in file

285
286
287
288
289
290
291
292
293
294
        sizes: '96x96',
    }],
}),

// Disabling this plugin until we come up with better bundle analysis ci
// new BundleAnalyzerPlugin({
//     analyzerMode: 'disabled',
//     generateStatsFile: true,
//     statsFilename: 'bundlestats.json',
// }),
fork icon0
star icon0
watch icon549

+ 3 other calls in file