-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
40 lines (39 loc) · 1.05 KB
/
Copy pathtsup.config.ts
File metadata and controls
40 lines (39 loc) · 1.05 KB
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 { defineConfig } from "tsup";
export default defineConfig([
{
name: "ESM Build",
entry: ["src/index.ts", "src/testing.ts"],
format: ["esm"],
outExtension: () => ({ js: ".mjs" }),
dts: false,
sourcemap: true,
clean: true,
// driver.js is loaded via dynamic import() — mark it external so the
// consumer's bundler (Vite/webpack) code-splits it into a separate chunk
// that's only downloaded when start() is first called.
external: ["react", "react-dom"],
},
{
name: "CJS Build",
entry: ["src/index.ts", "src/testing.ts"],
format: ["cjs"],
outExtension: () => ({ js: ".js" }),
dts: true,
sourcemap: true,
external: ["react", "react-dom"],
},
{
name: "UMD Build",
entry: { "react-driver": "src/index.ts" },
format: ["iife"],
globalName: "ReactDriver",
outExtension: () => ({ js: ".umd.js" }),
dts: false,
minify: true,
sourcemap: false,
external: ["react", "react-dom"],
esbuildOptions(opts) {
opts.globalName = "ReactDriver";
},
},
]);