-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
55 lines (54 loc) · 1.33 KB
/
rollup.config.mjs
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
import Resolve from "@rollup/plugin-node-resolve";
import CommonJS from "@rollup/plugin-commonjs";
import TypeScript from "@rollup/plugin-typescript";
import PostCSS from "rollup-plugin-postcss";
import DTS from "rollup-plugin-dts";
import Terser from "@rollup/plugin-terser";
import PeerDepsExternal from "rollup-plugin-peer-deps-external";
import Package from "./package.json" assert {type: "json"};
export default [
{
input: "src/index.ts",
output: [
{
file: Package.main,
format: "cjs",
},
{
file: Package.module,
format: "esm",
},
{
name: Package.name.replace(/^@noxy\//, ""),
file: Package.umd,
format: "umd",
globals: {
"react": "React",
},
},
],
plugins: [
PeerDepsExternal(), // Ensure peer-dependencies are not included in the bundle.
Resolve(), // Resolve external libraries and adds them to the bundle.
CommonJS(),
TypeScript({tsconfig: "./tsconfig.build.json", outputToFilesystem: true}),
PostCSS(),
Terser({sourceMap: true}),
],
},
{
input: "dist/esm/index.d.ts",
output: [
{
file: Package.types,
format: "esm",
},
],
plugins: [
DTS(),
],
external: [
/\.css$/,
],
},
];