-
Notifications
You must be signed in to change notification settings - Fork 107
/
rollup.config.js
99 lines (91 loc) · 1.91 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
89
90
91
92
93
94
95
96
97
98
99
import css from 'rollup-plugin-css-only';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import pkg from './package.json';
function pgl(plugins = []) {
return [
babel({
babelHelpers: 'bundled',
plugins: [
[
'@babel/plugin-transform-react-jsx',
{
importSource: 'preact',
runtime: 'automatic',
},
],
],
}),
css({
output: 'assets/form-js-playground.css',
}),
...plugins,
];
}
export default [
{
input: 'src/index.js',
output: [
{
sourcemap: true,
format: 'commonjs',
file: pkg.main,
},
{
sourcemap: true,
format: 'esm',
file: pkg.module,
},
],
plugins: pgl(),
external: [
'preact',
'preact/hooks',
'file-drops',
'mitt',
'downloadjs',
'@bpmn-io/form-js-editor',
'@bpmn-io/form-js-viewer',
'preact/jsx-runtime',
'@codemirror/state',
'@codemirror/lang-json',
'@codemirror/lint',
'@codemirror/view',
'@codemirror/commands',
'@codemirror/autocomplete',
'@codemirror/language',
'codemirror',
'classnames',
'min-dom',
'min-dash',
],
onwarn,
},
{
input: 'src/index.js',
output: [
{
format: 'umd',
file: pkg['umd:main'],
name: 'FormPlayground',
},
],
plugins: pgl([resolve(), commonjs()]),
onwarn,
},
];
function onwarn(warning, warn) {
// TODO(@barmac): remove once https://github.com/moment/luxon/issues/193 is resolved
if (warning.code === 'CIRCULAR_DEPENDENCY') {
if (warning.message.includes('luxon')) {
return;
}
}
if (warning.code === 'THIS_IS_UNDEFINED') {
if (warning.id.includes('flatpickr')) {
return;
}
}
warn(warning);
}