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.
64 lines
2.1 KiB
64 lines
2.1 KiB
|
3 years ago
|
|
||
|
|
|
||
|
|
const CompressionWebpackPlugin = require("compression-webpack-plugin");
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
lintOnSave: false, // 关闭eslint
|
||
|
|
publicPath: './',
|
||
|
|
assetsDir: "static",
|
||
|
|
outputDir: process.env.VUE_APP_FLAG === 'pro'?"dist":"test",
|
||
|
|
devServer: {
|
||
|
|
// host: '127.0.0.1',
|
||
|
|
host: '0.0.0.0',
|
||
|
|
port: 9529,
|
||
|
|
proxy: {
|
||
|
|
'/api': {
|
||
|
|
target: 'https://interface.douring.com',
|
||
|
|
changeOrigin: true,
|
||
|
|
pathRewrite: {
|
||
|
|
'/api': ''
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
productionSourceMap: false,
|
||
|
|
chainWebpack: (config) => {
|
||
|
|
config.plugins.delete('prefetch');
|
||
|
|
},
|
||
|
|
configureWebpack: {
|
||
|
|
plugins: [
|
||
|
|
new CompressionWebpackPlugin({
|
||
|
|
algorithm: 'gzip', // 使用gzip压缩
|
||
|
|
test: /\.js$|\.html$|\.css$/, // 匹配文件名
|
||
|
|
filename: '[path].gz[query]', // 压缩后的文件名(保持原文件名,后缀加.gz)
|
||
|
|
minRatio: 1, // 压缩率小于1才会压缩
|
||
|
|
threshold: 10240, // 对超过10k的数据压缩
|
||
|
|
deleteOriginalAssets: false, // 是否删除未压缩的源文件,谨慎设置,如果希望提供非gzip的资源,可不设置或者设置为false(比如删除打包后的gz后还可以加载到原始资源文件)
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
performance: {
|
||
|
|
hints: 'warning',
|
||
|
|
// 入口起点的最大体积
|
||
|
|
maxEntrypointSize: 50000000,
|
||
|
|
// 生成文件的最大体积
|
||
|
|
maxAssetSize: 30000000,
|
||
|
|
// 只给出 js 文件的性能提示
|
||
|
|
assetFilter: function (assetFilename) {
|
||
|
|
return assetFilename.endsWith('.js')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
configureWebpack: config => {
|
||
|
|
config.module.rules.push({
|
||
|
|
test: /\.worker.js$/,
|
||
|
|
use: {
|
||
|
|
loader: 'worker-loader',
|
||
|
|
options: { inline: true, name: 'workerName.[hash].js' }
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
parallel: false,
|
||
|
|
chainWebpack: config => {
|
||
|
|
config.output.globalObject('this')
|
||
|
|
}
|
||
|
|
}
|