-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
32 lines (30 loc) · 1.17 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
const path = require('path'); //引入path模块
function resolve(dir) {
return path.join(__dirname, dir) //path.join(__dirname)设置绝对路径
}
module.exports = {
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('./src'))
.set('components', resolve('./src/components'))
.set('assets', resolve('./src/assets'))
.set('common', resolve('./src/common'))
.set('network', resolve('./src/network'))
.set('views', resolve('./src/views'))
//set第一个参数:设置的别名,第二个参数:设置的路径
//发布时在main-prod
config.when(process.env.NODE_ENV === 'production', config => {
config.entry('app').clear().add('./src/main-prod.js')
})
//开发时
config.when(process.env.NODE_ENV === 'development', config => {
config.entry('app').clear().add('./src/main-dev.js')
})
config.set('externals', {
vue: 'Vue',
axios: 'axios',
})
},
//解决dist文件夹下面的index.html的css文件引入报错
publicPath: "./"
}