1
0
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:
David Wheatley
2021-04-10 15:00:48 +01:00
committed by GitHub
parent bc0ed8803d
commit 284d9a1461
4 changed files with 501 additions and 548 deletions

View File

@ -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)$/;