-
Notifications
You must be signed in to change notification settings - Fork 101
/
vue.config.js
47 lines (44 loc) · 1.33 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
const path = require("path");
const HardSourceWebpackPlugin = require("hard-source-webpack-plugin");
const AutoDllPlugin = require("autodll-webpack-plugin");
function resolve(dir) {
return path.join(__dirname, dir);
}
module.exports = {
assetsDir: "h5",
configureWebpack: config => {
Object.assign(config.resolve.alias, {
"@utils": resolve("src/utils"),
"@libs": resolve("src/libs"),
"@api": resolve("src/api"),
"@components": resolve("src/components"),
"@assets": resolve("src/assets"),
"@css": resolve("src/assets/css"),
"@images": resolve("src/assets/images"),
"@views": resolve("src/views"),
"@mixins": resolve("src/mixins")
});
if (process.env.NODE_ENV !== "production") {
config.plugins.push(
new HardSourceWebpackPlugin(),
new AutoDllPlugin({
inject: true,
debug: true,
filename: "[name]_[hash].js",
path: "./dll" + Date.parse(new Date()),
entry: {
vendor_vue: ["vue", "vuex", "vue-router"],
vendor_ui: ["vue-awesome-swiper", "vue-ydui"],
vendor_tools: ["axios", "core-js"]
}
})
);
}
},
chainWebpack: config => {
config.plugin("html").tap(args => {
args[0].VUE_APP_NAME = process.env.VUE_APP_NAME;
return args;
});
}
};