-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
78 lines (70 loc) · 1.64 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
import size from 'rollup-plugin-filesize'
import { terser } from 'rollup-plugin-terser'
import minifyPrivates from 'ts-transformer-minify-privates'
import ts from '@wessberg/rollup-plugin-ts'
const $size = size({ showMinifiedSize: false })
const transformers = [
service => ({
before: [minifyPrivates(service.program)]
})
]
const $ts = ts({
transpiler: 'babel',
})
const $tsmin = ts({
transpiler: 'babel',
transformers,
})
const $terser = terser({
ecma: 2015,
compress: {
passes: 2,
reduce_vars: false,
keep_fnames: true,
},
mangle: {
properties: {
regex: /^_private_/
},
reserved: ['Box'],
}
})
export default [
{
input: 'src/index.ts',
plugins: [$ts],
output: [
{
file: 'dist/index.js',
format: 'cjs',
},
{
file: 'dist/index.esm.js',
format: 'esm',
},
{
file: 'dist/index.umd.js',
format: 'umd',
name: 'Box',
},
]
},
{
input: 'src/index.ts',
plugins: [$tsmin],
output: [
{
file: 'dist/index.umd.min.js',
format: 'umd',
name: 'Box',
plugins: [$terser, $size],
},
// this is just for information: it's not packaged
{
file: 'dist/data/index.esm.min.js',
format: 'esm',
plugins: [$terser, $size],
},
]
},
]