-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
70 lines (61 loc) · 1.93 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 path = require('path')
const configs = require('./config')
const utils = require('./build/utils')
// 用于做相应的merge处理
const isPro = process.env.NODE_ENV === 'production'
const cfg = isPro ? configs.build.env : configs.dev.env
const resolve = dir => {
return path.join(__dirname, dir)
}
let publicPath = '/vue/';
module.exports = {
publicPath: publicPath,
productionSourceMap: true,
pages: utils.setPages({
addScript() {
if (isPro) {
return `
<script src="https://s95.cnzz.com/z_stat.php?id=xxx&web_id=xxx" language="JavaScript"></script>
`
}
return ''
}
}),
/*css: {
modules: true,
},*/
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src'))
.set('_lib', resolve('src/common'))
.set('_com', resolve('src/components'))
.set('_img', resolve('src/images'))
.set('_ser', resolve('src/services'))
},
configureWebpack: config => {
},
devServer: {
historyApiFallback: {
rewrites: [
{ from: new RegExp(publicPath + 'page1'), to: publicPath + 'page1.html' },
{ from: new RegExp(publicPath + 'page2'), to: publicPath + 'page2.html' },
]
},
host: '127.0.0.1', // 指定使用一个 host。默认是 localhost
port: 8080, // 端口地址
https: false, // 使用https提供服务
// string | Object 代理设置
proxy: {
'/noauth': {
target: 'https://api.backblazeb2.com/',
changeOrigin: true,
pathRewrite: {'^/noauth': ''}
},
'/auth': {
target: 'https://api004.backblazeb2.com/',
changeOrigin: true,
pathRewrite: {'^/auth': ''}
}
},
}
}