1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| const appConfig = require('./src/app.config')
|
| 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,
| devServer: {
| host: 'localhost',
| open: true,
| port: 8888,
| // overlay: false,
| overlay: {
| warnings: true,
| errors: true
| }
| // proxy: {
| // '/hcstms': {
| // target: 'http://10.238.221.113',
| // changeOrigin: true,
| // ws: true,
| // pathRewrite: {
| // '^/hcstms': ''
| // }
| // }
| // }
| }
| }
|
|