-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.cjs
48 lines (45 loc) · 1.09 KB
/
rollup.config.cjs
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
const typescript = require('rollup-plugin-typescript2');
const { babel } = require('@rollup/plugin-babel');
const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const { terser } = require('rollup-plugin-terser');
const dts = require('rollup-plugin-flat-dts');
const del = require('rollup-plugin-delete');
const { builtinModules } = require('module');
const { dependencies } = require('./package.json');
module.exports = [
{
input: 'src/index.ts',
output: [
{
file: `dist/index.cjs`,
format: 'cjs',
preferConst: true,
plugins: [dts()],
},
{
file: `dist/index.mjs`,
format: 'esm',
preferConst: true,
plugins: [dts()],
},
],
plugins: [
typescript({ tsconfig: './tsconfig.json' }),
babel({
babelHelpers: 'bundled',
exclude: '**/node_modules/**',
}),
resolve(),
commonjs(),
/* Optionally uncomment the line below
to minify the final bundle: */
// terser(),
],
external: [
...builtinModules,
'node:buffer',
...Object.keys(dependencies),
],
},
];