-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
48 lines (46 loc) · 1.01 KB
/
rollup.config.ts
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
import terser from '@rollup/plugin-terser';
import clean from 'rollup-plugin-delete';
import fileSize from 'rollup-plugin-filesize';
import license from 'rollup-plugin-license';
import ts from 'rollup-plugin-ts';
import pkg from './package.json' assert { type: 'json' };
import cfg from './tsconfig.json' assert { type: 'json' };
export default [
{
input: './src/index.ts',
output: [
{
format: 'umd',
file: pkg.main,
name: pkg.title, // var name of browser global
},
{
format: 'esm',
file: pkg.module,
},
],
plugins: [
clean({
targets: `${cfg.compilerOptions.outDir}/*`,
}),
fileSize({
showMinifiedSize: false,
}),
ts({
hook: {
outputPath: (path, kind) => (kind === 'declaration' ? pkg.types : path), // only one single type declaration file, instead of one per output file
},
}),
terser(),
license({
banner: {
commentStyle: 'ignored',
content: {
file: './banner.txt',
encoding: 'utf-8',
},
},
}),
],
},
];