-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
56 lines (56 loc) · 1.66 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
const path = require("path");
function resolve(dir) {
return path.join(__dirname, dir);
}
const name = "DSP物流绘图生成器v1.0";
module.exports = {
css: {
loaderOptions: {
scss: {
prependData: `@import "@/styles/index.scss";`,
},
},
},
publicPath: "./",
productionSourceMap: false,
outputDir: "dist",
configureWebpack: {
name: name,
resolve: {
alias: {
"@": resolve("src"),
},
},
},
chainWebpack: (config) => {
config.module
.rule("images")
.test(/\.(png|jpe?g|gif|webp|bmp)$/)
.use("url-loader")
.loader("url-loader")
.tap((options) => Object.assign(options, { limit: 500000 }));
config.module
.rule("fonts")
.test(/\.(ttf|woff)$/)
.use("url-loader")
.loader("url-loader")
.tap((options) => Object.assign(options, { limit: 500000 }));
config.plugin("preload").tap((args) => {
args[0].fileBlacklist.push(/\.css/, /\.js/);
return args;
});
config.plugin("inline-source").use(require("html-webpack-inline-source-plugin"));
config.plugin("html").tap((args) => {
args[0].inlineSource = "(.css|.js$)";
return args;
});
config.optimization.minimizer("terser").tap((args) => {
args[0].terserOptions.compress.drop_console = true; //删除打印
args[0].terserOptions.compress.drop_debugger = true;
args[0].terserOptions.compress.pure_funcs = ["console.log"]; // 移除console.log方法
args[0].terserOptions.output = { comments: false }; //删除所有注释
args[0].extractComments = false; //是否将注释全部集中到一个文件中
return args;
});
},
};