-
Notifications
You must be signed in to change notification settings - Fork 411
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
47 lines (44 loc) · 1.06 KB
/
rollup.config.mjs
File metadata and controls
47 lines (44 loc) · 1.06 KB
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 resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
const external = ['react', 'react-dom', 'react/jsx-runtime'];
const createConfig = (input, outputName) => ({
input,
external,
output: [
{
file: `dist/${outputName}.js`,
format: 'esm',
sourcemap: true,
},
{
file: `dist/${outputName}.cjs`,
format: 'cjs',
sourcemap: true,
exports: 'named',
},
],
plugins: [
resolve(),
commonjs(),
typescript({
tsconfig: './tsconfig.json',
declaration: true,
declarationDir: './dist',
exclude: ['**/*.test.ts', '**/*.test.tsx', '**/*.stories.tsx'],
}),
terser({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
},
}),
],
});
export default [
createConfig('src/index.ts', 'index'),
createConfig('src/keyboard.ts', 'keyboard'),
createConfig('src/persistence.ts', 'persistence'),
];