-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
110 lines (104 loc) · 2.67 KB
/
rollup.config.mjs
File metadata and controls
110 lines (104 loc) · 2.67 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import baseConfig from './rollup.base.config.mjs';
import terser from '@rollup/plugin-terser';
import { dts } from 'rollup-plugin-dts';
export default [
/* ---------------------------------------- */
// Bundling for the main library (index.ts)
{
input: './src/index.ts',
output: [
{
file: './dist/index.cjs.min.cjs',
format: 'cjs',
exports: 'auto', // 'auto' ensures compatibility with both default and named exports in CommonJS
sourcemap: true,
},
{
file: './dist/index.esm.min.mjs',
format: 'esm',
exports: 'named', // Named exports for ES modules
sourcemap: true,
},
],
plugins: [
...baseConfig.plugins,
terser(), // Minification
],
external: baseConfig.external,
},
// TypeScript declarations for the main library (index.ts)
{
input: './src/index.ts',
output: {
file: './dist/index.d.ts',
format: 'esm',
},
plugins: [dts()],
},
/* ---------------------------------------- */
// Bundling for the internal library (internal.ts)
{
input: './src/internal.ts',
output: [
{
file: './dist/internal.cjs.min.cjs',
format: 'cjs',
exports: 'auto', // 'auto' ensures compatibility with both default and named exports in CommonJS
sourcemap: true,
},
{
file: './dist/internal.esm.min.mjs',
format: 'esm',
exports: 'named', // Named exports for ES modules
sourcemap: true,
},
],
plugins: [
...baseConfig.plugins,
terser(), // Minification
],
external: baseConfig.external,
},
// TypeScript declarations for the internal library (internal.ts)
{
input: './src/internal.ts',
output: {
file: './dist/internal.d.ts',
format: 'esm',
},
plugins: [dts()],
},
/* ---------------------------------------- */
// Bundling for the client library (client.ts)
{
input: 'src/client.ts',
output: [
{
file: './dist/client.cjs.min.cjs',
format: 'cjs',
exports: 'auto', // 'auto' ensures compatibility with both default and named exports in CommonJS
sourcemap: true,
},
{
file: './dist/client.esm.min.mjs',
format: 'esm',
exports: 'named', // Named exports for ES modules
sourcemap: true,
},
],
plugins: [
...baseConfig.plugins,
terser(), // Minification
],
external: baseConfig.external,
},
// TypeScript declarations for the client library (client.ts)
{
input: './src/client.ts',
output: {
file: './dist/client.d.ts',
format: 'esm',
},
plugins: [dts()],
},
];