-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
38 lines (35 loc) · 1.07 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
import typeScriptPlugin from "@rollup/plugin-typescript";
import { defineConfig } from "rollup";
import cleanupPlugin from "rollup-plugin-cleanup";
import copyPlugin from "rollup-plugin-copy";
import progressPlugin from "rollup-plugin-progress";
import packageJSON from "./lib/package.json";
const EXTERNALS = Object.keys({
...packageJSON.dependencies,
...packageJSON.peerDependencies,
});
const EXTERNALS_REGEX = new RegExp(EXTERNALS.join("|"));
export default defineConfig({
input: ["lib/src/index.tsx", "lib/src/server.tsx"],
external: EXTERNALS_REGEX,
output: {
entryFileNames: "[name].js",
dir: "build",
format: "cjs",
sourcemap: true,
exports: "named",
},
plugins: [
progressPlugin(),
typeScriptPlugin({ tsconfig: "lib/tsconfig.json" }),
copyPlugin({
targets: [
{ src: "lib/package.json", dest: "build" },
{ src: "lib/src/types.d.ts", dest: "build" },
{ src: "README.md", dest: "build" },
{ src: "LICENSE", dest: "build" },
],
}),
cleanupPlugin({ extensions: ["js", "ts"] }),
],
});