You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.6 KiB
36 lines
1.6 KiB
11 months ago
|
/**
|
||
|
* 生产环境构建
|
||
|
*/
|
||
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); // css 压缩插件
|
||
|
const TerserPlugin = require("terser-webpack-plugin"); // js 压缩插件
|
||
|
const { merge } = require('webpack-merge'); // webpack 配置合并函数
|
||
|
const build = require('./webpack.env.build.cjs'); // 开发环境构建配置
|
||
|
|
||
|
module.exports = merge(build, {
|
||
|
mode: 'production',
|
||
|
// -------------------------------------------------------------------------------------------------------------------------------
|
||
|
// devtool | performance | comment
|
||
|
// (none) | build:fastest, rebuild:fastest | Recommended choice for production builds with maximum performance.
|
||
|
// eval | build:fast, rebuild:fastest | Recommended choice for development builds with maximum performance.
|
||
|
// eval-source-map| build:slowest, rebuild:ok | Recommended choice for development builds with high quality SourceMaps.
|
||
|
// source-map | build:slowest, rebuild:slowest | Recommended choice for production builds with high quality SourceMaps.
|
||
|
// -------------------------------------------------------------------------------------------------------------------------------
|
||
|
devtool: 'source-map',
|
||
|
optimization: {
|
||
|
minimize: true,
|
||
|
minimizer: [
|
||
|
new CssMinimizerPlugin(), // css 压缩插件
|
||
|
new TerserPlugin({ // js 压缩插件
|
||
|
extractComments: false,
|
||
|
terserOptions: {
|
||
|
format: {
|
||
|
comments: false,
|
||
|
},
|
||
|
},
|
||
|
}),
|
||
|
],
|
||
|
moduleIds: 'named',
|
||
|
chunkIds: 'named',
|
||
|
},
|
||
|
});
|