-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.ts
50 lines (48 loc) · 1.28 KB
/
rollup.config.ts
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
import typescript from '@rollup/plugin-typescript'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
import analyze from 'rollup-plugin-analyzer'
import sizes from 'rollup-plugin-sizes'
import copy from 'rollup-plugin-copy'
const production = !process.env.ROLLUP_WATCH
export default {
input: 'src/index.ts', // Entry point
output: [
{
file: 'dist/bundle.cjs.js',
format: 'cjs', // CommonJS format
sourcemap: true
},
{
file: 'dist/bundle.esm.js',
format: 'esm', // ES Module format
sourcemap: true
},
{
file: 'dist/bundle.umd.js',
name: 'StimulusStore',
format: 'umd',
sourcemap: true
}
],
plugins: [
typescript({ tsconfig: './tsconfig.json' }), // TypeScript support
copy({
targets: [{ src: 'src/**/*.d.ts', dest: 'dist' }],
flatten: false
}),
commonjs(), // CommonJS support
resolve(), // Node.js module resolution
production &&
terser({
// Terser for minification in production
output: { comments: false },
compress: {
drop_console: true // Remove console logs in production
}
}),
analyze(), // Bundle analysis
sizes() // Size analysis
]
}