-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
82 lines (78 loc) · 1.89 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
71
72
73
74
75
76
77
78
79
80
81
82
const webpack = require("webpack");
const path = require('path');
const isBuild = process.argv.includes("build")
function resolve(dir) {
return path.join(__dirname, dir);
}
const port = 8594
function getProxyPath(proxyPath = {}) {
const mockPath = require("./src/utils/mockProxy");
mockPath.map((path) => {
proxyPath[`${path}`] = {
target: `http://localhost:${port}/dev-api`,
changeOrigin: true, // 是否跨域
ws: true,
pathRewrite: {}
};
})
return proxyPath;
}
module.exports = {
publicPath: '',
outputDir: 'dist',
assetsDir: 'static',
productionSourceMap: false,
css: { extract: false },
devServer: {
port: port,
open: true,
overlay: {
warnings: false,
errors: true
},
proxy: {
...getProxyPath()
},
before: require('./mock/mock-server.js')
},
configureWebpack: {
resolve: {
alias: {
'@': resolve('src')
}
},
plugins: [],
externals: isBuild ? {
"axios": "axios",
"dayjs": "dayjs",
"element-resize-detector": "element-resize-detector",
"element-ui": "element-ui",
"exceljs": "exceljs",
"ramda": "ramda",
"richform": "richform",
"screenfull": "screenfull",
"short-uuid": "short-uuid",
"vue-i18n": "vue-i18n",
"vxe-pc-ui": "vxe-pc-ui",
"vxe-table": "vxe-table",
"vxe-table-plugin-export-xlsx": "vxe-table-plugin-export-xlsx"
} : {}
},
// to handle element icon error in build.
chainWebpack: config => {
// it can improve the speed of the first screen, it is recommended to turn on preload
config.module
.rule("fonts")
.test(/.(ttf|otf|eot|woff|woff2)$/)
.use("url-loader")
.loader("url-loader")
.tap(options => {
options = {
// limit: 10000,
name: '/static/fonts/[name].[ext]',
}
return options
})
.end()
}
}