-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
66 lines (64 loc) · 1.4 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
const webpack = require('webpack');
const window = require('./config/config');
module.exports = {
// production 的路徑 folder
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
// build 時不產生雜湊值
filenameHashing: false,
// 不產生 production 環境的 source map
productionSourceMap: false,
// 開發時使用,避免串接 api 的 CORS 問題
devServer: {
proxy: {
'/baseProxy': {
target: window.__env.url.BASE_HOST,
changeOrigin: true,
pathRewrite: {
'^/baseProxy': '',
},
},
'/api': {
target: 'http://hedgedoc.flowring.com',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
},
},
},
// 設定 css 全域變數
css: {
loaderOptions: {
sass: {
additionalData: `
@import "@/assets/styles/_variable.scss";
`,
},
},
},
chainWebpack: (config) => {
// 維護 api url,build後仍可修改
config.plugin('copy').tap(([pathConfigs]) => {
pathConfigs.patterns.unshift({
from: 'config',
to: 'config',
});
return [pathConfigs];
});
// 使 router 在 tomcat 下可以正常運行
config.plugin('copy').tap(([pathConfigs]) => {
pathConfigs.patterns.unshift({
from: 'WEB-INF',
to: 'WEB-INF',
});
return [pathConfigs];
});
// 提供全域使用
config.plugin('provide').use(webpack.ProvidePlugin, [
{
_: 'lodash',
dayjs: 'dayjs',
},
]);
},
}