-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
34 lines (31 loc) · 1.04 KB
/
build.js
File metadata and controls
34 lines (31 loc) · 1.04 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
import tailwind from "bun-plugin-tailwind";
// Plugin to force React resolution to the project root
// This prevents duplicate React instances when using linked packages (like tilia)
const resolveReactToRoot = {
name: "resolve-react-to-root",
setup(build) {
// Match react, react-dom, and their subpaths (like react/jsx-runtime)
build.onResolve({ filter: /^react(-dom)?/ }, async (args) => {
// Resolve relative to the current working directory (project root)
const resolved = await Bun.resolve(args.path, process.cwd());
return {
path: resolved,
};
});
},
};
console.log("Building client...");
await Bun.build({
publicPath: `${process.env.API_BASE_URL}/`,
plugins: [tailwind, resolveReactToRoot],
entrypoints: ["./lib/ui/index.html", "./lib/node_modules/executor.ui/Index.mjs"],
outdir: "public",
env: "inline",
});
console.log("Building server...");
await Bun.build({
target: "bun",
plugins: [resolveReactToRoot],
entrypoints: ["./lib/node_modules/executor/Server.mjs"],
outdir: "./dist",
});