forked from sufansufan/vue-webTk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
61 lines (58 loc) · 1.48 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
// const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CompressionPlugin = require("compression-webpack-plugin");
const path = require("path");
const resolve = dir => {
return path.join(__dirname, dir);
};
module.exports = {
devServer: {
proxy: "http://192.168.1.123:8083"
},
css: {
loaderOptions: {
sass: {
data: `@import "@/assets/css/base.scss";`
}
}
},
assetsDir: "./",
configureWebpack: {
entry: {
app: ["babel-polyfill", "@/main.js"]
},
// module: {
// rules: [
// {
// test: /\.css$/,
// use: [MiniCssExtractPlugin.loader, "css-loader"]
// }
// ]
// },
plugins: [
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.html$/,
threshold: 10240,
minRatio: 0.8
})
// new MiniCssExtractPlugin({
// filename: "[name].[chunkhash:8].css",
// chunkFilename: "[id].css"
// })
]
// externals: {
// vue: "Vue",
// "vue-router": "VueRouter",
// vuex: "Vuex",
// axios: "axios",
// "element-ui": "ELEMENT"
// }
},
chainWebpack: config => {
config.resolve.alias
.set("@", resolve("src")) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set("_c", resolve("src/components"))
.set("_conf", resolve("config"));
}
};