46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
const CompressionWebpackPlugin = require('compression-webpack-plugin');
|
|
const { transformElementScss } = require('ele-admin/lib/utils/dynamic-theme');
|
|
|
|
module.exports = {
|
|
devServer: {
|
|
port: process.env.PORT || 8200,
|
|
proxy: {
|
|
'/pingan': {
|
|
target: process.env.URL,
|
|
changeOrigin: true,
|
|
pathRewrite: { '^/pingan/common': '/common' } //路由重写调用公共方法
|
|
}
|
|
}
|
|
},
|
|
productionSourceMap: false,
|
|
transpileDependencies: ['element-ui', 'ele-admin', 'vue-i18n'],
|
|
configureWebpack: {
|
|
performance: {
|
|
maxAssetSize: 2000000,
|
|
maxEntrypointSize: 2000000
|
|
}
|
|
},
|
|
chainWebpack(config) {
|
|
config.plugins.delete('prefetch');
|
|
if (process.env.NODE_ENV !== 'development') {
|
|
// gzip 压缩
|
|
config.plugin('compressionPlugin').use(
|
|
new CompressionWebpackPlugin({
|
|
test: /\.(js|css|html)$/,
|
|
threshold: 10240
|
|
})
|
|
);
|
|
}
|
|
},
|
|
css: {
|
|
loaderOptions: {
|
|
sass: {
|
|
sassOptions: {
|
|
outputStyle: 'expanded',
|
|
importer: transformElementScss()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|