-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathvue.config.js
61 lines (58 loc) · 1.7 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 { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const path = require("path");
module.exports = {
devServer: {
disableHostCheck: true,
proxy: {
"/setcookie": {
target: "http://localhost", // not used, we just need the pathRewrite hook
changeOrigin: true,
pathRewrite: function(path, req) {
req.res.statusCode = 302;
req.res.cookie("first_cookie", "1", { maxAge: 3600 * 24 * 365 * 10 });
req.res.setHeader("Location", "http://localhost:12380?redirected");
req.res.end();
return "";
}
}
}
},
configureWebpack: () => {
if (process.env.BUNDLE_ANALYZER) {
// merges into config https://cli.vuejs.org/guide/webpack.html#simple-configuration
return {
plugins: [new BundleAnalyzerPlugin()]
};
}
},
chainWebpack: config => {
// Import setup scss into all processed scss
const types = ["vue-modules", "vue", "normal-modules", "normal"];
types.forEach(type =>
config.module
.rule("scss")
.oneOf(type)
.use("style-resource")
.loader("style-resources-loader")
.options({
patterns: [path.resolve(__dirname, "./src/scss/setup/all.scss")]
})
);
// https://vue-svg-loader.js.org/faq.html#how-to-use-both-inline-and-external-svgs
const svgRule = config.module.rule("svg");
svgRule.uses.clear();
svgRule
.use("vue-svg-loader")
.loader("vue-svg-loader")
.options({
svgo: {
plugins: [{ removeViewBox: false }]
}
});
config.module
.rule("pdf")
.test(/\.pdf$/)
.use("file-loader")
.loader("file-loader");
}
};