-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
88 lines (84 loc) · 2.3 KB
/
rollup.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import path from "path";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import replace from "@rollup/plugin-replace";
import postcss from "rollup-plugin-postcss";
import postcssUrl from "postcss-url";
export default [
{
input: "src/index.js",
output: {
dir: "dist",
format: "iife",
},
plugins: [
nodeResolve(),
commonjs(),
postcss({
extract: path.resolve("dist/index.css"),
}),
],
},
{
input: "src/dialog.js",
output: {
dir: "dist",
format: "iife",
},
plugins: [
nodeResolve(),
commonjs(),
],
},
{
input: "src/vuetify.js",
output: {
dir: "dist",
format: "iife",
},
plugins: [
{
name: "handle-vue-default-import",
resolveId(source) {
if (source !== "vue") {
return null;
}
return path.resolve(path.dirname(require.resolve("vue")), "vue.common.js");
},
},
nodeResolve(),
commonjs(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
}),
postcss({
extract: path.resolve("dist/vuetify.css"),
plugins: [postcssUrl([{ filter: "**/*.woff2", url: "inline" }])],
}),
{
name: "remove-reset-from-vuetify-styles",
generateBundle(options, bundle) {
const start = `/*!
* ress.css • v2.0.4
* MIT License
* github.com/filipelinhares/ress
*/
/* # =================================================================
# Global selectors
# ================================================================= */`.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
const end = `/* # =================================================================
# Accessibility
# ================================================================= */`.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
const regExp = new RegExp(`${start}(.*?)(${end})`, "s");
for (const [fileName, info] of Object.entries(bundle)) {
if (fileName.match(/vuetify\.css/)) {
const input = info.source.toString();
const output = input.replace(regExp, "$2");
info.source = output;
}
}
},
},
],
},
];