-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.bundle.config.ts
More file actions
45 lines (43 loc) · 1.31 KB
/
tsup.bundle.config.ts
File metadata and controls
45 lines (43 loc) · 1.31 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
41
42
43
44
45
import { defineConfig } from "tsup";
const PROD_API_URL = "https://hackprinceton--dploy-backend-fastapi-app.modal.run";
export default defineConfig({
entry: ["src/cli.tsx"],
format: ["esm"],
target: "node20",
outDir: "dist",
clean: true,
sourcemap: false,
shims: true,
banner: {
js:
"#!/usr/bin/env node\n" +
"import { createRequire as __dployCreateRequire } from 'module';\n" +
"const require = __dployCreateRequire(import.meta.url);\n",
},
// Inline the prod URL at build time. config.ts reads this as
// `process.env.DPLOY_DEFAULT_API_URL`; esbuild substitutes it as a string
// literal so the runtime never actually touches process.env for it.
define: {
"process.env.DPLOY_DEFAULT_API_URL": JSON.stringify(PROD_API_URL),
},
noExternal: [/.*/],
splitting: false,
treeshake: true,
minify: false,
esbuildPlugins: [
{
name: "stub-react-devtools-core",
setup(build) {
build.onResolve({ filter: /^react-devtools-core$/ }, (args) => ({
path: args.path,
namespace: "stub",
}));
build.onLoad({ filter: /.*/, namespace: "stub" }, () => ({
contents:
"const noop = () => {};\nexport default noop;\nexport const connectToDevTools = noop;\n",
loader: "js",
}));
},
},
],
});