"scripts": {
"serve": "vue-cli-service serve",
"build": "cross-env NODE_ENV=production vue-cli-service build",
"build:pre": "cross-env NODE_ENV=pre_env vue-cli-service build",
"build:test": "cross-env NODE_ENV=test vue-cli-service build",
"lint": "vue-cli-service lint"
},
module.exports = {
publicPath: ‘/‘,
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir: ‘dist‘,
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: ‘static‘,
devServer: {
disableHostCheck: true,
open: true
},
productionSourceMap: false,
chainWebpack: config => {
config.optimization.minimize(true);
},
configureWebpack: config => {
if (process.env.NODE_ENV !== ‘development‘) {
config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = [‘console.log‘]
config.devtool = (process.env.NODE_ENV === ‘test‘ || process.env.NODE_ENV === ‘pre_env‘) ? ‘source-map‘ : undefined
}
}
}