-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
97 lines (96 loc) · 2.53 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
97
const path = require("path");
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const webpack = require("webpack");
const version = require("./.github/version.json").version;
const dayjs = require("dayjs");
require("dayjs/locale/zh-cn");
dayjs.locale("zh-cn");
const time = dayjs().format("YYYY-M-D HH:mm:ss");
module.exports = {
// publicPath: "https://s-sh-1943-mingyan-static.oss.dogecdn.com/public/",
productionSourceMap: false,
configureWebpack: (config) => {
config.externals = {
vue: "Vue",
marked: "marked",
"vue-router": "VueRouter",
};
config.resolve = {
alias: {
"@ant-design/icons/lib/dist$": path.resolve(
__dirname,
"./src/js/icons.js"
),
},
};
config.optimization = {
runtimeChunk: {
name: (entrypoint) => `runtime-${entrypoint.name}`,
},
splitChunks: {
automaticNameDelimiter: "-",
chunks: "all",
maxInitialRequests: Infinity,
minSize: 50000,
maxSize: 50000,
minChunks: 1,
cacheGroups: {
vendor: {
name: "vendor",
minChunks: 2,
test: /[\\/]node_modules[\\/]/,
priority: -50,
},
},
},
};
},
chainWebpack: (config) => {
config
.plugin("banner")
.use(webpack.BannerPlugin, [
[
"ERSS SAYING",
`(c) 2020-${new Date().getFullYear()} Xhemj`,
`Build: ${time}`,
`Version: ${version}`,
"====",
"o(〃^▽^〃)o",
].join("\n"),
]);
config.plugin("html").tap((args) => {
args[0].TIME = time;
args[0].VERSION = version;
args[0].NOW_YEAR = new Date().getFullYear();
args[0].minify = {
collapseWhitespace: true,
keepClosingSlash: true,
removeComments: false,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
};
return args;
});
config.plugin("webpack-bundle-analyzer").use(BundleAnalyzerPlugin);
config.plugins.delete("preload");
config.plugins.delete("prefetch");
},
filenameHashing: true,
css: {
extract: true,
loaderOptions: {
less: {
javascriptEnabled: true,
modifyVars: {
"primary-color": "#9B4DC9",
"link-color": "#5755d9",
"border-radius-base": "2px",
"text-color": "#303742",
},
},
},
},
};