-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvue.config.js
96 lines (92 loc) · 2.68 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const path = require("path");
var webpack = require("webpack");
const resolve = dir => {
return path.join(__dirname, dir);
};
const isProd = process.env.NODE_ENV === "production";
const assetsCDN = {
// webpack build externals
externals: {
vue: "Vue",
vuex: "Vuex",
axios: "axios",
"view-design": "iview",
"./cptable": "var cptable",
"./jszip": "jszip",
echarts: "echarts",
"monaco-editor": "monaco-editor"
},
css: [],
// https://unpkg.com/browse/[email protected]/
js: [
isProd ? "//cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js" : "//cdn.jsdelivr.net/npm/[email protected]/dist/vue.js",
"//cdn.jsdelivr.net/npm/[email protected]/dist/vuex.min.js",
"//cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js",
"//cdn.jsdelivr.net/npm/[email protected]/dist/iview.min.js",
"//cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"
]
};
module.exports = {
// Project deployment base
// By default we assume your app will be deployed at the root of a domain,
// e.g. https://www.my-app.com/
// If your app is deployed at a sub-path, you will need to specify that
// sub-path here. For example, if your app is deployed at
// https://www.foobar.com/my-app/
// then change this to '/my-app/'
publicPath: "kettle-admin",
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// 如果你不需要使用eslint,把lintOnSave设为false即可
lintOnSave: true,
chainWebpack: config => {
config.resolve.alias
.set("@", resolve("src")) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set("_c", resolve("src/components"));
config.plugin("html").tap(args => {
args[0].cdn = assetsCDN;
return args;
});
},
// 设为false打包时不生成.map文件
productionSourceMap: false,
configureWebpack: {
plugins: [
// (...)
new webpack.IgnorePlugin(/cptable/)
],
node: {
fs: "empty"
},
externals: assetsCDN.externals
},
pluginOptions: {
"style-resources-loader": {
preProcessor: "less",
patterns: ["./src/styles/variable.less"]
}
},
css: {
extract: process.env.NODE_ENV == "production" ? true : false,
sourceMap: process.env.NODE_ENV == "development" ? true : false,
loaderOptions: {
less: {
javascriptEnabled: true,
paths: [
path.resolve(__dirname, "src"),
path.resolve(__dirname, "node_modules")
]
}
}
},
runtimeCompiler: true,
devServer: {
proxy: {
"/xtl-server": {
target: "http://localhost:9876/xtl-server/",
pathRewrite: { "^/xtl-server": "" },
changeOrigin: true
}
}
}
};