forked from remix-run/react-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.ts
47 lines (42 loc) · 1.15 KB
/
tsup.config.ts
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
import { defineConfig } from "tsup";
// @ts-ignore - out of scope
import { createBanner } from "../../build.utils.js";
import pkg from "./package.json";
const entry = ["index.ts", "dom-export.ts", "lib/types/route-module.ts"];
const config = (enableDevWarnings: boolean) =>
defineConfig([
{
clean: false,
entry,
format: ["cjs"],
outDir: enableDevWarnings ? "dist/development" : "dist/production",
dts: true,
banner: {
js: createBanner(pkg.name, pkg.version),
},
define: {
"import.meta.hot": "undefined",
REACT_ROUTER_VERSION: JSON.stringify(pkg.version),
__DEV__: JSON.stringify(enableDevWarnings),
},
},
{
clean: false,
entry,
format: ["esm"],
outDir: enableDevWarnings ? "dist/development" : "dist/production",
dts: true,
banner: {
js: createBanner(pkg.name, pkg.version),
},
define: {
REACT_ROUTER_VERSION: JSON.stringify(pkg.version),
__DEV__: JSON.stringify(enableDevWarnings),
},
},
]);
export default defineConfig([
// @ts-expect-error
...config(false),
...config(true),
]);