-
Notifications
You must be signed in to change notification settings - Fork 1
/
vue.config.js
47 lines (45 loc) · 1.18 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
function enableShadowCss(config) {
const configs = [config.module.rule("vue").use("vue-loader")];
// based on common rules returned by `vue inspect`
const ruleSets = ["css", "postcss", "scss", "sass", "less", "stylus"];
const ruleNames = ["vue-modules", "vue", "normal-modules", "normal"];
ruleSets.forEach(ruleSet => {
if (config.module.rules.store.has(ruleSet)) {
ruleNames.forEach(rName => {
if (config.module.rule(ruleSet).oneOfs.store.has(rName)) {
if (
config.module
.rule(ruleSet)
.oneOf(rName)
.uses.store.has("vue-style-loader")
) {
configs.push(
config.module
.rule(ruleSet)
.oneOf(rName)
.use("vue-style-loader")
);
}
}
});
}
});
if (!process.env.BUILD_MODE) {
process.env.BUILD_MODE = config.store.get("mode");
}
configs.forEach(c =>
c.tap(options => {
options.shadowMode = true;
return options;
})
);
}
module.exports = {
chainWebpack: config => {
enableShadowCss(config);
},
css: {
sourceMap: true,
extract: false
}
};