-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvue.config.js
More file actions
53 lines (43 loc) · 1.26 KB
/
Copy pathvue.config.js
File metadata and controls
53 lines (43 loc) · 1.26 KB
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
44
45
46
47
48
49
50
51
52
53
const path = require('path');
function resolve(dir){
return path.join(__dirname,dir)
}
module.exports = {
// assetsDir: 'static', // *仅本地开发打开 build时注掉
publicPath: process.env.VUE_APP_PUBLIC_PATH, // *仅发布生产环境打开 本地开发时注掉
filenameHashing:false,
lintOnSave:false,
devServer: {
host: '0.0.0.0',
port: "8081",
disableHostCheck: true,
open: true,
proxy: {
"/api": {
target: "http://xxx.com/front",
changeOrigin: true,
secure: false,
pathRewrite:{
'^/api': ''
}
}
}
},
// 适配
chainWebpack: config => {
config.module
.rule('less','css')
.oneOf('vue')
.use('px2rem-loader')
.loader('px2rem-loader')
.before('postcss-loader') // this makes it work.
.options({
remUnit: 192, //代表的是 1rem = ?px 设计稿是 1920px ,那么这里的比例就是 1/10
remPrecision: 5
})
.end()
},
chainWebpack: config=>{
config.resolve.alias.set('@',resolve('src'))
}
};