-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
73 lines (72 loc) · 2.17 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
const webpack = require("webpack");
const prefixer = require("postcss-prefix-selector");
module.exports = {
transpileDependencies: ["vuetify"],
css: {
extract: false,
},
configureWebpack: {
externals: {
jquery: "jQuery",
$: "jQuery",
},
entry: {
main: "./src/main.ts",
browserSupport: "./src/browserSupport.js",
},
output: {
filename: "gv-dashboard.[name].[fullhash:7].js",
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
}),
],
optimization: { splitChunks: false },
},
chainWebpack: (config) => {
config.module.rules.delete("eslint");
const sassRule = config.module.rule("sass");
const sassNormalRule = sassRule.oneOfs.get("normal");
// creating a new rule
const vuetifyRule = sassRule
.oneOf("vuetify")
.test(/[\\/]vuetify[\\/]src[\\/]/);
// taking all uses from the normal rule and adding them to the new rule
Object.keys(sassNormalRule.uses.entries()).forEach((key) => {
vuetifyRule.uses.set(key, sassNormalRule.uses.get(key));
});
// moving rule "vuetify" before "normal"
sassRule.oneOfs.delete("normal");
sassRule.oneOfs.set("normal", sassNormalRule);
// adding prefixer to the "vuetify" rule
vuetifyRule
.use("vuetify")
.loader(require.resolve("postcss-loader"))
.tap((options = {}) => {
options.sourceMap = process.env.NODE_ENV !== "production";
options.postcssOptions = {
plugins: [
prefixer({
prefix: "[data-vuetify]",
transform(prefix, selector, prefixedSelector) {
let result = prefixedSelector;
if (
selector.startsWith("html") ||
selector.startsWith("body")
) {
result = prefix + selector.substring(4);
}
return result;
},
}),
],
};
return options;
});
// moving sass-loader to the end
vuetifyRule.uses.delete("sass-loader");
vuetifyRule.uses.set("sass-loader", sassNormalRule.uses.get("sass-loader"));
},
};