-
Notifications
You must be signed in to change notification settings - Fork 23
/
vue.config.js
52 lines (52 loc) · 1.59 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
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
outputDir: process.env.VUE_APP_ENV === "lib" ? "dist" : "demo/build",
assetsDir: "assets",
lintOnSave: process.env.NODE_ENV === "development",
pages: {
index: {
entry: "demo/index.js",
template: "demo/index.html",
filename: "index.html",
favicon: "demo/site.ico",
title: "数字键盘实例"
}
},
css: {
extract: process.env.VUE_APP_ENV === "lib" || process.env.NODE_ENV === "production" ? true : false
},
configureWebpack: config => {
// config.output = {
// libraryExport: 'default'
// }
if (process.env.VUE_APP_ENV === "lib") {
config.externals = {
vue: "vue"
};
config.output.libraryExport = "default";
}
},
chainWebpack: config => {
if (process.env.VUE_APP_ENV == "lib") {
// lib 模式删除 HTML 相关的 webpack 插件
config.plugins.delete("html");
config.plugins.delete("preload");
config.plugins.delete("prefetch");
} else {
// config.plugin("html").tap(args => {
// args[0].favicon = path.resolve("demo/site.ico");
// return args;
// });
}
},
devServer: {
// host: '0.0.0.0',
// port: 8100,
// open: true,
disableHostCheck: true, // 禁用服务检查
overlay: {
warnings: false,
errors: true
}
}
};