mirror of
https://github.com/flarum/core.git
synced 2025-07-16 06:16:23 +02:00
Add Webpack Bundle Analyzer to webpack config (#12)
This commit is contained in:
@ -25,12 +25,21 @@ function getEntryPoints() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
const useBundleAnalyzer = process.env.ANALYZER === 'true';
|
||||
const plugins = [];
|
||||
|
||||
if (useBundleAnalyzer) {
|
||||
plugins.push(new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)());
|
||||
}
|
||||
|
||||
module.exports = function (options = {}) {
|
||||
return {
|
||||
// Set up entry points for each of the forum + admin apps, but only
|
||||
// if they exist.
|
||||
entry: getEntryPoints(),
|
||||
|
||||
plugins,
|
||||
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
|
||||
},
|
||||
@ -91,8 +100,10 @@ module.exports = function (options = {}) {
|
||||
|
||||
if (options.useExtensions) {
|
||||
for (const extension of options.useExtensions) {
|
||||
externals['@' + extension] = externals['@' + extension + '/forum'] = externals['@' + extension + '/admin'] =
|
||||
"flarum.extensions['" + extension + "']";
|
||||
externals['@' + extension] =
|
||||
externals['@' + extension + '/forum'] =
|
||||
externals['@' + extension + '/admin'] =
|
||||
"flarum.extensions['" + extension + "']";
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user