-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
76 lines (76 loc) · 1.82 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
/*
* @Description: vue.config.js
* @Version: 2.0.0
* @Autor: lax
* @Date: 2020-04-01 12:54:53
* @LastEditors: lax
* @LastEditTime: 2020-09-15 16:00:07
*/
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require("path");
module.exports = {
/* ##################################
* test view path for the local debug
* ##################################
*/
pages: {
index: {
entry: "./examples/main.js",
template: "./public/index.html",
filename: "index.html",
},
},
/* ##################################
* js css version like: xx.js?v=xxxxx
* ##################################
*/
configureWebpack: (config) => {
config.devtool = "source-map";
return {
output: {
filename: "js/[name].js?v=[hash:6]",
chunkFilename: "js/[name].js?v=[hash:6]",
},
plugins: [
new MiniCssExtractPlugin({
filename: `css/[name].css?v=[hash:6]`,
chunkFilename: `css/[name].css?v=[hash:6]`,
}),
],
};
},
/* 设置build的引用文件路径 */
publicPath: "./",
/* 生产环境sourcemap 清除 */
productionSourceMap: false,
/* 取消文件名hash值 */
filenameHashing: false,
/**
* 自定义file-loader
* html图片访问格式调整:[name].[ext]?v=[hash:6]
* like: content.png?v=s2421a
*/
chainWebpack: (config) => {
config.module
.rule("js")
.include.add("/packages/")
.end()
.use("babel")
.loader("babel-loader");
config.module
.rule("images")
.use("url-loader")
.loader("file-loader")
.options({
name: "img/[name].[ext]?v=[hash:6]",
useRelativePath: true,
});
/* ##################################
* @ use pro core @ex use to test
* ##################################
*/
config.resolve.alias
.set("@", path.join(__dirname, "./packages"))
.set("@ex", path.join(__dirname, "./examples"));
},
};