Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
analyzerPort: process.env.ANALYZE_PORT || 8888,
openAnalyzer: process.env.ANALYZE_OPEN !== 'none',
// generate stats file while ANALYZE_DUMP exist
generateStatsFile: !!process.env.ANALYZE_DUMP,
statsFilename: process.env.ANALYZE_DUMP || 'stats.json',
logLevel: process.env.ANALYZE_LOG_LEVEL || 'info',
defaultSizes: 'parsed', // stat // gzip
},
]);
}
// plugins -> analyze report
if (process.env.ANALYZE_REPORT) {
webpackConfig
.plugin('bundle-analyzer-reporter')
.use(require('umi-webpack-bundle-analyzer').BundleAnalyzerPlugin, [
{
analyzerMode: 'disabled', // 关闭 analyzer server
generateReportFile: true, // 开启报告生成功能
reportDepth: 2, // 裁剪深度 2
reportDir: process.cwd(),
statsFilename: process.env.ANALYZE_DUMP || 'bundlestats.json', // 默认生成到 bundlestats.json
},
]);
}
if (process.env.DUPLICATE_CHECKER) {
webpackConfig
.plugin('duplicate-package-checker')
.use(require('duplicate-package-checker-webpack-plugin'));
}