|
@@ -4,6 +4,7 @@ const defaultSettings = require('./src/settings.js')
|
|
|
function resolve(dir) {
|
|
|
return path.join(__dirname, dir)
|
|
|
}
|
|
|
+const CompressionPlugin = require('compression-webpack-plugin')
|
|
|
|
|
|
const name = defaultSettings.title || 'CPMS管理系统' // 标题
|
|
|
|
|
@@ -45,6 +46,25 @@ module.exports = {
|
|
|
},
|
|
|
disableHostCheck: true
|
|
|
},
|
|
|
+
|
|
|
+ configureWebpack: {
|
|
|
+ name: name,
|
|
|
+ resolve: {
|
|
|
+ alias: {
|
|
|
+ '@': resolve('src')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ plugins: [
|
|
|
+ new CompressionPlugin({
|
|
|
+ test: /\.(js|css|html)?$/i, // 压缩文件格式
|
|
|
+ filename: '[path].gz[query]', // 压缩后的文件名
|
|
|
+ algorithm: 'gzip', // 使用gzip压缩
|
|
|
+ threshold: 10240, // 对超过10K的数据压缩
|
|
|
+ minRatio: 0.8 // 压缩率小于1才会压缩
|
|
|
+ })
|
|
|
+ ],
|
|
|
+ },
|
|
|
+
|
|
|
chainWebpack(config) {
|
|
|
//去除打包后缀的hash值
|
|
|
// config.output.filename('static/js/[name].js').end();
|