-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvue.config.js
43 lines (40 loc) · 1.08 KB
/
vue.config.js
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
40
41
42
43
const { defineConfig } = require('@vue/cli-service')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const path = require('path')
module.exports = defineConfig({
configureWebpack: {
plugins: [new NodePolyfillPlugin()],
resolve: {
alias: {
"@": path.resolve("./src") // 相对路径别名配置,使用 @ 代替 src
}
},
},
transpileDependencies: true,
lintOnSave: false,
devServer: {
host: '0.0.0.0',
port: 8081,
client: {
webSocketURL: 'ws://0.0.0.0/ws',
},
},
chainWebpack:config =>{
//发布模式
config.when(process.env.NODE_ENV === 'production',config =>{
config.entry('app').clear().add('./src/main-prod.js')
config.plugin('html').tap(args => {
args[0].isProd = true
return args
})
})
//开发模式
config.when(process.env.NODE_ENV === 'development',config =>{
config.entry('app').clear().add('./src/main-dev.js')
config.plugin('html').tap(args => {
args[0].isProd = false
return args
})
})
}
})