-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.js
More file actions
27 lines (24 loc) · 675 Bytes
/
build.js
File metadata and controls
27 lines (24 loc) · 675 Bytes
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
const { build } = require("esbuild");
const { dependencies, peerDependencies } = require("./package.json");
const entryFile = "src/index.tsx";
const shared = {
bundle: true,
entryPoints: [entryFile],
// Treat all dependencies in package.json as externals to keep bundle size to a minimum
external: Object.keys({ ...dependencies, ...peerDependencies }),
logLevel: "info",
minify: true,
sourcemap: true,
};
build({
...shared,
format: "esm",
outfile: "./lib/index.esm.js",
target: ["esnext", "node12.22.0"],
});
build({
...shared,
format: "cjs",
outfile: "./lib/index.cjs.js",
target: ["esnext", "node12.22.0"],
});