Skip to content

Commit 98eff32

Browse files
centdixclaude
andauthored
fix: bundle backend at publish time to resolve missing dependencies (#40)
When installed globally, backend workspace dependencies (like `yaml`) were not resolved because only root package.json dependencies are installed. Instead of duplicating every backend dep in the root, bundle the backend into a single JS file via `bun build --target=bun` during prepublishOnly. This inlines all dependencies so the published package has zero runtime deps. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5612e60 commit 98eff32

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ backend/node_modules/
44
backend/bun.lock
55
frontend/node_modules/
66
frontend/bun.lock
7+
backend/dist/
78
frontend/dist/
89
frontend/.vite/
910
public/

bin/wmdev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ process.on("SIGTERM", cleanup);
126126

127127
// ── Start ────────────────────────────────────────────────────────────────────
128128

129-
const backendEntry = join(PKG_ROOT, "backend", "src", "server.ts");
129+
const backendEntry = join(PKG_ROOT, "backend", "dist", "server.js");
130130
const staticDir = join(PKG_ROOT, "frontend", "dist");
131131

132132
if (!existsSync(staticDir)) {

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@
2727
"dev": "bash dev.sh",
2828
"start": "bun bin/wmdev.js",
2929
"build": "cd frontend && bun run build",
30-
"prepublishOnly": "bun run build",
30+
"build:backend": "bun build backend/src/server.ts --target=bun --outfile=backend/dist/server.js",
31+
"prepublishOnly": "bun run build && bun run build:backend",
3132
"test": "bun run --cwd backend test && bun run --cwd frontend test",
3233
"test:coverage": "bun run --cwd backend test --coverage && bun run --cwd frontend test:coverage"
3334
},
3435
"files": [
3536
"bin/",
36-
"backend/src/*.ts",
37-
"backend/src/lib/",
38-
"backend/tsconfig.json",
37+
"backend/dist/",
3938
"frontend/dist/"
4039
],
4140
"devDependencies": {

0 commit comments

Comments
 (0)