-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
40 lines (39 loc) · 1.23 KB
/
rollup.config.js
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
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import terser from "@rollup/plugin-terser";
export default {
input: "index.ts", // Entry point of your library
output: [
{
dir: "dist", // Output directory
format: "cjs", // CommonJS format
sourcemap: true, // Generate source maps
entryFileNames: "[name].cjs", // Output file name pattern
chunkFileNames: "[name]-[hash].cjs", // Chunk file name pattern
},
{
dir: "dist", // Output directory
format: "esm", // ES Module format
sourcemap: true, // Generate source maps
entryFileNames: "[name].esm.js", // Output file name pattern
chunkFileNames: "[name]-[hash].esm.js", // Chunk file name pattern
},
],
plugins: [
resolve(), // Resolve node_modules
commonjs(), // Convert CommonJS modules to ES6
typescript({
exclude: [
"**/__tests__",
"**/*.test.ts",
"coverage",
"dist",
"eslint.config.mjs",
"jest.config.js",
"rollup.config.js",
], // Exclude files from compilation
}), // Compile TypeScript
terser(), // Minify the output
],
};