当bundle-analyzer
开发人员运行yarn analyze
已设置package.json
为"analyze": "craco build --analyze-only"
.
我确实阅读了craco
手册,但没有找到任何解决方案。我当前的配置如下:
const progressBar = require('./progressBar.webpack.config');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;
module.exports = {
reactScriptsVersion: 'react-scripts' /* (default value) */,
webpack: {
alias: {},
plugins: {
add: [progressBar()] /* An array of plugins */
},
configure: (webpackConfig, { env, paths }) => {
if (env === 'production') {
webpackConfig.plugins.push(new BundleAnalyzerPlugin());
}
return webpackConfig;
}
}
};
我们如何将参数传递给它?