| | |
| | | if (process.env.NODE_ENV === 'development') { |
| | | chain |
| | | .plugin('analyzer') |
| | | .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [{ analyzerPort: 8889 }]); |
| | | .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [{ analyzerPort: 8890 }]); |
| | | } |
| | | |
| | | chain.plugin('unplugin-auto-import').use( |
| | |
| | | }) |
| | | ); |
| | | |
| | | chain.merge({ |
| | | plugin: { |
| | | install: { |
| | | plugin: require('terser-webpack-plugin'), |
| | | args: [ |
| | | { |
| | | terserOptions: { |
| | | compress: true, // 默认使用terser压缩 |
| | | keep_classnames: true, // 不改变class名称 |
| | | keep_fnames: true, // 不改变函数名称 |
| | | if (process.env.NODE_ENV !== 'development') { |
| | | chain.merge({ |
| | | plugin: { |
| | | install: { |
| | | plugin: require('terser-webpack-plugin'), |
| | | args: [ |
| | | { |
| | | terserOptions: { |
| | | compress: true, // 默认使用terser压缩 |
| | | keep_classnames: true, // 不改变class名称 |
| | | keep_fnames: true, // 不改变函数名称 |
| | | }, |
| | | }, |
| | | }, |
| | | ], |
| | | ], |
| | | }, |
| | | }, |
| | | }, |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | chain.merge({ |
| | | optimization: { |