-
Notifications
You must be signed in to change notification settings - Fork 3
/
vue.config.js
70 lines (65 loc) · 1.55 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const {
MiniAppZipWebpackPlugin,
getEntries
} = require('@kugou-miniapp/cli-service')
const {
prepareUrls
} = require('@kugou-miniapp/cli-shared-utils')
module.exports = {
devServer: {
proxy: {
//请求路径 带有 / demo 的走代理 http://localhost:8081/
'/demo': {
target: 'http://localhost:8081/dev-api', //代理为什么 ip:端口
changeOrigin: true, //允许跨域
pathRewrite: {
'^/demo': '' //表示将路径重写为 http://localhost:8081/demo
}
}
},
},
chainWebpack: config => {
config
.externals({
'mini-app': 'MiniApp'
})
if (process.env.VUE_APP_DEVTOOL && process.env.NODE_ENV === 'development') {
const urls = prepareUrls('http', '0.0.0.0')
config
.plugin('define')
.tap(args => {
args[0]['process.env.DEVTOOL_HOST'] = JSON.stringify(urls.lanUrlForConfig)
args[0]['process.env.DEVTOOL_PORT'] = JSON.stringify(8098)
return args
})
}
if (process.env.NODE_ENV === 'production') {
config
.plugin('mini-app-zip')
.use(MiniAppZipWebpackPlugin, [{
r: [{
name: "index",
content: "all"
}],
t: 'dist',
d: 'dist'
}])
}
},
pages: getEntries(),
publicPath: './',
css: {
loaderOptions: {
sass: {
prependData: `
@import "~@/styles/mixins.scss"
`
},
scss: {
prependData: `
@import "~@/styles/mixins.scss";
`
}
}
}
}