-
Notifications
You must be signed in to change notification settings - Fork 107
/
rollup.config.js
80 lines (76 loc) · 1.94 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 alias from '@rollup/plugin-alias';
import babel from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
import reactSvg from '@svgr/rollup';
import resolve from '@rollup/plugin-node-resolve';
import pkg from './package.json';
function pgl(plugins = []) {
return [
alias({
entries: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom', replacement: 'preact/compat' },
// we need this to make sure we use the same
// preact version for the properties panel
{ find: '../preact', replacement: 'preact' },
{ find: '../preact/hooks', replacement: 'preact/hooks' },
{ find: '../preact/jsx-runtime', replacement: 'preact/jsx-runtime' },
],
}),
resolve({
resolveOnly: ['diagram-js', '@bpmn-io/properties-panel'],
}),
reactSvg(),
babel({
babelHelpers: 'bundled',
plugins: [
[
'@babel/plugin-transform-react-jsx',
{
importSource: 'preact',
runtime: 'automatic',
},
],
],
}),
...plugins,
];
}
export default [
{
input: 'src/index.js',
output: [
{
sourcemap: true,
format: 'commonjs',
file: pkg.main,
},
{
sourcemap: true,
format: 'esm',
file: pkg.module,
},
],
external: [
'ids',
'min-dash',
'array-move',
'big.js',
'preact',
'preact/jsx-runtime',
'preact/hooks',
'preact/compat',
'@bpmn-io/draggle',
'@bpmn-io/form-js-viewer',
],
plugins: pgl([
copy({
targets: [
{ src: 'assets/form-js-editor-base.css', dest: 'dist/assets' },
{ src: '../../node_modules/@bpmn-io/draggle/dist/draggle.css', dest: 'dist/assets' },
{ src: '../../node_modules/@bpmn-io/properties-panel/dist/assets/properties-panel.css', dest: 'dist/assets' },
],
}),
]),
},
];