forked from tnhu/status-indicator
-
Notifications
You must be signed in to change notification settings - Fork 17
/
rollup.config.js
86 lines (83 loc) · 1.75 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
import vue from 'rollup-plugin-vue';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import css from 'rollup-plugin-css-only';
import pckg from './package.json';
// Dynamic module config
const inputFile = pckg.plugin.entryFile;
const BrowserNamePackage = pckg.plugin.name;
const ModuleNamePackage = pckg.name;
const config = [
// ESM build to be used with webpack/rollup.
{
input: inputFile,
output: {
format: 'esm',
exports: 'named',
name: ModuleNamePackage,
file: `dist/${ModuleNamePackage}.esm.js`,
},
plugins: [
resolve({
extensions: ['.js', '.vue'],
}),
commonjs(),
vue(),
],
},
// Common Js
{
input: inputFile,
output: {
format: 'cjs',
exports: 'named',
name: ModuleNamePackage,
file: `dist/${ModuleNamePackage}.cjs.js`,
},
plugins: [
resolve({
extensions: ['.js', '.vue'],
}),
commonjs(),
vue(),
],
},
// SSR Build
{
input: inputFile,
output: {
format: 'cjs',
exports: 'named',
name: ModuleNamePackage,
file: `dist/${ModuleNamePackage}.ssr.js`,
},
plugins: [
resolve({
extensions: ['.js', '.vue'],
}),
commonjs(),
vue({ template: { optimizeSSR: true } }),
],
},
// Browser build
{
input: inputFile,
output: {
format: 'iife',
exports: 'named',
name: BrowserNamePackage,
file: `dist/${ModuleNamePackage}.js`,
},
plugins: [
resolve({
extensions: ['.js', '.vue'],
}),
commonjs(),
css(),
vue({ css: false }),
terser(),
],
},
];
export default config;