const appConfig = require('./src/app.config')
|
const path = require('path')
|
module.exports = {
|
publicPath: process.env.NODE_ENV === 'production' ? `/${appConfig.projectName}/` : '/',
|
configureWebpack: config => {
|
config.name = appConfig.title
|
config.resolve.alias = Object.assign(config.resolve.alias, require('./aliases.config').webpack)
|
// 生产环境去掉注释及相关控制台信息方法
|
if (process.env.NODE_ENV === 'production') {
|
config.optimization.minimizer[0].options.extractComments = true
|
config.optimization.minimizer[0].options.terserOptions.output.comments = false
|
config.optimization.minimizer[0].options.terserOptions.compress.warnings = true
|
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
|
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
|
}
|
},
|
parallel: require('os').cpus().length > 1, // 构建时开启多进程处理babel编译
|
productionSourceMap: false,
|
pluginOptions: {
|
'style-resources-loader': {
|
preProcessor: 'less',
|
patterns: [
|
path.resolve(__dirname, './src/assets/css/map/_map-variable.less')
|
]
|
}
|
},
|
devServer: {
|
// host: 'localhost',
|
// open: true,
|
port: 8080,
|
// overlay: false,
|
overlay: {
|
warnings: true,
|
errors: true
|
}
|
// proxy: {
|
// '/hcstms': {
|
// target: 'http://10.238.221.113',
|
// changeOrigin: true,
|
// ws: true,
|
// pathRewrite: {
|
// '^/hcstms': ''
|
// }
|
// }
|
// }
|
}
|
}
|