-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
47 lines (44 loc) · 940 Bytes
/
rollup.config.mjs
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 typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import nodePolyfills from 'rollup-plugin-polyfill-node';
const base = {
input: 'scripts/tsc.ts',
plugins: [
nodeResolve({ browser: true, preferBuiltins: false }),
commonjs(),
nodePolyfills({ include: ['perf-hooks'] }),
typescript({
tsconfig: 'tsconfig.cjs.json',
}),
],
};
const esm = {
file: 'scripts/tsc.esm.js',
format: 'esm',
};
const cjs = {
file: 'scripts/tsc.js',
format: 'cjs',
exports: 'named',
};
export default [
{
...base,
output: [
cjs,
{
...cjs,
file: 'scripts/tsc.min.js',
plugins: [terser()],
},
esm,
{
...esm,
file: 'scripts/tsc.esm.min.js',
plugins: [terser()],
},
],
},
];