mirror of
https://github.com/flarum/core.git
synced 2025-07-15 13:56:23 +02:00
Add option to build with Webpack Bundle Analyzer (#2708)
* Add option to build with webpack bundle analyzer * Bump npm to v7 as recommended in actions/setup-node#213 * Workaround for npm/cli#558 * Add missing dep
This commit is contained in:
@ -1,6 +1,15 @@
|
||||
const config = require('flarum-webpack-config');
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
const merge = require('webpack-merge');
|
||||
|
||||
const useBundleAnalyzer = process.env.ANALYZER === 'true';
|
||||
|
||||
const plugins = [];
|
||||
|
||||
if (useBundleAnalyzer) {
|
||||
plugins.push(new BundleAnalyzerPlugin());
|
||||
}
|
||||
|
||||
module.exports = merge(config(), {
|
||||
output: {
|
||||
library: 'flarum.core',
|
||||
@ -10,6 +19,8 @@ module.exports = merge(config(), {
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js', '.json'],
|
||||
},
|
||||
|
||||
plugins,
|
||||
});
|
||||
|
||||
module.exports['module'].rules[0].test = /\.(tsx?|js)$/;
|
||||
|
Reference in New Issue
Block a user