-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
37 lines (29 loc) · 1.16 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
import rpi_jsy from 'rollup-plugin-jsy'
import rpi_dgnotify from 'rollup-plugin-dgnotify'
import rpi_terser from '@rollup/plugin-terser'
const plugins = [ rpi_jsy(), rpi_dgnotify() ]
const plugins_web = [ ... plugins, rpi_terser({}) ]
export default [
... add_main_jsy('index', 'roap'),
].flat().filter(Boolean)
function * add_main_jsy(src_name, name) {
yield ({ input: `code/${src_name}.jsy`, plugins,
output: [
{ file: `esm/${name}.mjs`, format: 'es', sourcemap: true },
{ file: `cjs/${name}.cjs`, format: 'cjs', sourcemap: true },
{ file: `umd/${name}.js`, name, format: 'umd', sourcemap: true },
]})
if (plugins_web)
yield ({
input: `code/${src_name}.jsy`, plugins: plugins_web,
output: [
{ file: `esm/${name}.min.mjs`, format: 'es' },
{ file: `umd/${name}.min.js`, name, format: 'umd' },
]})
}
function * add_jsy(src_name, out_name=src_name) {
yield ({ input: `code/${src_name}.jsy`, plugins,
output: { file: `esm/${out_name}.mjs`, format: 'es', sourcemap: true} })
yield ({ input: `code/${src_name}.jsy`, plugins: plugins_web,
output: { file: `esm/${out_name}.min.mjs`, format: 'es'} })
}