implements env-based bundle analyzer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const getStyleLoaders = require('./getStyleLoaders');
|
||||
@@ -81,7 +81,6 @@ module.exports = (config) => {
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
// new BundleAnalyzerPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
template: config.admin && config.admin.indexHTML
|
||||
? path.join(config.paths.configDir, config.admin.indexHTML)
|
||||
@@ -102,6 +101,10 @@ module.exports = (config) => {
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.PAYLOAD_ANALYZE_BUNDLE) {
|
||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin());
|
||||
}
|
||||
|
||||
if (config.paths.scss) {
|
||||
webpackConfig.resolve.alias['payload-scss-overrides'] = path.join(config.paths.configDir, config.paths.scss);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user