-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
80 lines (74 loc) · 1.58 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
import vue from 'rollup-plugin-vue';
import svg from 'rollup-plugin-svg';
import css from 'rollup-plugin-css-only';
import { terser } from 'rollup-plugin-terser';
import CleanCSS from 'clean-css';
import { writeFileSync } from 'fs';
const vueOptions = {
css: false,
template: {
compilerOptions: { whitespace: 'condense' },
},
};
export default [
// Minified ESM browser build
{
input: 'src/browser-wrapper.js',
output: {
format: 'iife',
file: 'dist/embetty-vue.browser.min.js',
},
plugins: [
css({
output(styles) {
const minified = new CleanCSS({}).minify(styles);
writeFileSync('dist/embetty-vue.css', styles);
writeFileSync('dist/embetty-vue.min.css', minified.styles);
},
}),
svg(),
vue({ ...vueOptions }),
terser({ mangle: false }),
],
},
// ESM browser build
{
input: 'src/browser-wrapper.js',
output: {
format: 'iife',
file: 'dist/embetty-vue.browser.js',
},
plugins: [
css({ output: false }),
svg(),
vue({ ...vueOptions }),
],
},
// ESM bundler build
{
input: 'src/plugin.js',
output: {
format: 'esm',
file: 'dist/embetty-vue.mjs',
},
plugins: [
css({ output: false }),
svg(),
vue({ ...vueOptions }),
],
},
// CommonJS bundler build
{
input: 'src/plugin.js',
output: {
format: 'cjs',
file: 'dist/embetty-vue.cjs',
exports: 'named',
},
plugins: [
css({ output: false }),
svg(),
vue({ ...vueOptions }),
],
},
];