forked from jellyfin/jellyfin-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.analyze.js
28 lines (20 loc) · 934 Bytes
/
webpack.analyze.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const { merge } = require('webpack-merge');
const prod = require('./webpack.prod');
const smp = new SpeedMeasurePlugin();
const config = merge(prod, {
plugins: [
new BundleAnalyzerPlugin({
excludeAssets: /-json\..*\.chunk\.js$/
})
]
});
const searchPlugin = (name) => config.plugins.findIndex((e) => e.constructor.name === name);
// NOTE: We need to re-add the mini css plugin to workaround this issue
// https://github.com/stephencookdev/speed-measure-webpack-plugin/issues/167
const miniCssPluginIndex = searchPlugin('MiniCssExtractPlugin');
const miniCssPlugin = config.plugins[miniCssPluginIndex];
const exportedConfig = smp.wrap(config);
exportedConfig.plugins[miniCssPluginIndex] = miniCssPlugin;
module.exports = exportedConfig;