-
Notifications
You must be signed in to change notification settings - Fork 63
/
rollup.config.js
62 lines (54 loc) · 1.17 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
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript';
import resolve from 'rollup-plugin-node-resolve';
import pkg from './package.json';
const DEST = 'dist';
const MODULE_NAME = 'FormSchema';
const BANNER = `/* ${pkg.name} v${pkg.version} (c) ${pkg.author} - ${pkg.license} */`;
const ResolvePlugin = resolve({
browser: true
});
const TerserPlugin = terser({
compress: true,
output: {
comments: new RegExp(`^ ${pkg.name}`)
}
});
const ES6_PLUGINS = [
ResolvePlugin,
typescript({
target: 'es6'
}),
TerserPlugin
];
const ES5_PLUGINS = [
ResolvePlugin,
typescript({
target: 'es5'
}),
TerserPlugin
];
function build (format, suffix = format) {
return {
input: 'src/components/FormSchema.ts',
cache: true,
output: {
file: `${DEST}/${MODULE_NAME}.${suffix}.min.js`,
format,
name: MODULE_NAME,
indent: false,
sourcemap: true,
exports: 'named',
banner: BANNER
},
plugins: format === 'es' ? ES6_PLUGINS : ES5_PLUGINS
};
}
export default [
build('es', 'esm'),
build('amd'),
build('cjs'),
build('iife'),
build('umd'),
build('system')
];