generated from shgysk8zer0/npm-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
47 lines (43 loc) · 976 Bytes
/
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
import terser from '@rollup/plugin-terser';
import nodeResolve from '@rollup/plugin-node-resolve';
const t = terser();
const nr = nodeResolve();
const configs = ['base', 'html', 'svg', 'mathml', 'complete'];
const modules = [
'sanitizer', 'config', 'config/base', 'config/complete', 'config/html',
'config/html', 'config/html', 'config/mathml', 'config/svg', 'config/global',
'namespaces', 'config-utils', 'sanitize',
];
export default [
{
input: 'polyfill.js',
plugins: [nr],
output: [{
file: 'polyfill.cjs',
format: 'cjs',
}, {
file: 'polyfill.min.js',
format: 'iife',
sourcemap: true,
plugins: [t],
}],
},
...modules.map(path => ({
input: `${path}.js`,
external: () => true,
output: {
file: `${path}.cjs`,
format: 'cjs',
},
})),
...configs.map(path => ({
input: `config/${path}.js`,
plugins: [nr],
output: {
file: `config/${path}.min.js`,
format: 'module',
sourcemap: true,
plugins: [t],
}
})),
];