forked from Aaron-China/vue-cli3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
57 lines (55 loc) · 1.66 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
const path = require('path')
const webpack = require('webpack')
function resolve (dir) {
return path.join(__dirname, dir)
}
// https://cli.vuejs.org/zh/config/#css-loaderoptions
module.exports = {
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [path.resolve(__dirname, "src/app.less")] // 引入全局样式变量
}
},
css: {
loaderOptions: {
less: {
javascriptEnabled: true
}
}
},
chainWebpack: (config) => {
config.resolve.alias
.set('@', resolve('src'))
.set('@api', resolve('src/api'))
.set('@assets', resolve('src/assets'))
.set('@layouts', resolve('src/layouts'))
.set('@static', resolve('src/static'))
.set('@components', resolve('src/components'))
.set('@router', resolve('src/router'))
.set('@utils', resolve('src/utils'))
.set('@store', resolve('src/store'))
.set('@views', resolve('src/views'))
},
// 服务转发
devServer: {
port: 8003,
proxy: {
'/WebSocketConfig/': {
target: 'ws://test.com',
changeOrigin: true,
ws: true, // 开启sockjs
},
'/api/': {
target: 'http://test.com',
changeOrigin: true,
ws: false, // 关闭sockjs
},
},
},
// disable source map in production
productionSourceMap: false,
lintOnSave: false,
// babel-loader no-ignore node_modules/*
transpileDependencies: [],
}