-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
75 lines (73 loc) · 1.89 KB
/
Copy pathrollup.config.js
File metadata and controls
75 lines (73 loc) · 1.89 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';
const commonPlugins = (external = []) => ({
plugins: [
resolve(),
typescript({
tsconfig: './tsconfig.json',
declaration: true,
declarationDir: 'dist/types'
})
],
external
});
export default [
// Main bundle (everything: core + react)
{
input: 'src/index.ts',
output: [
{ file: 'dist/index.js', format: 'cjs', sourcemap: true },
{ file: 'dist/index.mjs', format: 'esm', sourcemap: true }
],
...commonPlugins(['react', 'react-dom'])
},
// Core bundle (utils + types, no React)
{
input: 'src/core.ts',
output: [
{ file: 'dist/core.js', format: 'cjs', sourcemap: true },
{ file: 'dist/core.mjs', format: 'esm', sourcemap: true }
],
...commonPlugins([])
},
// React bundle (hooks only)
{
input: 'src/react.ts',
output: [
{ file: 'dist/react.js', format: 'cjs', sourcemap: true },
{ file: 'dist/react.mjs', format: 'esm', sourcemap: true }
],
...commonPlugins(['react', 'react-dom'])
},
// Server bundle (alias for core)
{
input: 'src/server.ts',
output: [
{ file: 'dist/server.js', format: 'cjs', sourcemap: true },
{ file: 'dist/server.mjs', format: 'esm', sourcemap: true }
],
...commonPlugins([])
},
// Type definitions
{
input: 'dist/types/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
plugins: [dts()]
},
{
input: 'dist/types/core.d.ts',
output: [{ file: 'dist/core.d.ts', format: 'esm' }],
plugins: [dts()]
},
{
input: 'dist/types/react.d.ts',
output: [{ file: 'dist/react.d.ts', format: 'esm' }],
plugins: [dts()]
},
{
input: 'dist/types/server.d.ts',
output: [{ file: 'dist/server.d.ts', format: 'esm' }],
plugins: [dts()]
}
];