-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.cjs
49 lines (46 loc) · 1.24 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
49
const typescript = require('@rollup/plugin-typescript');
const { babel } = require('@rollup/plugin-babel');
const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const json = require('@rollup/plugin-json');
const { terser } = require('rollup-plugin-terser');
const dts = require('rollup-plugin-dts').default;
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,
},
{
file: `dist/index.mjs`,
format: 'esm',
preferConst: true,
},
],
plugins: [
typescript({ tsconfig: './tsconfig.json' }),
babel({
babelHelpers: 'bundled',
exclude: '**/node_modules/**',
}),
resolve(),
commonjs(),
json(),
/* Optionally uncomment the line below
to minify the final bundle: */
// terser(),
],
external: [...builtinModules, ...Object.keys(dependencies)],
},
{
input: 'dist/dts/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [dts(), del({ hook: 'buildEnd', targets: './dist/dts' })],
},
];