-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.mjs
41 lines (36 loc) · 980 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
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import css from 'rollup-plugin-import-css';
import pkg from './package.json' with { type: 'json' };
import del from 'rollup-plugin-delete';
const externalDependencies = Object.keys({
...pkg.peerDependencies,
...pkg.dependencies,
});
const extensions = ['.tsx', '.ts'];
export default [
{
input: './src/index.ts',
external: ['@babel/runtime', 'react/jsx-runtime', ...externalDependencies],
plugins: [
del({ targets: 'dist/*', runOnce: true }),
resolve({ extensions }),
commonjs(),
typescript({
tsconfig: './tsconfig.build.json',
}),
css(),
terser(),
],
output: [
{
dir: 'dist',
preserveModules: true,
preserveModulesRoot: 'src',
format: 'es',
},
],
},
];