ubiquitous-invention/apps/collab-server/package.json
Randall Stillwell b992db5b3e collab: replace createRequire shim with normal imports
The collab server was using createRequire() with hardcoded relative paths
(../../../packages/database/package.json, ../node_modules/@hocuspocus/server/...)
to grab `eq` from drizzle-orm and `Forbidden` from @hocuspocus/common. That
worked under tsx in dev but fell apart in the bundled prod image because
those paths don't exist there and pnpm's symlink topology in the runtime
node_modules wasn't reachable from inside the bundled dist file.

Result at runtime: Cannot find module '@hocuspocus/common' on every
collab restart, infinite crash loop.

Switch both to plain ESM imports — tsup bundles them into dist/index.mjs
directly, no runtime resolution needed. Add @hocuspocus/common and
drizzle-orm as explicit deps so they're properly tracked.

Verified locally: bundle now resolves cleanly with no createRequire calls
(actually shrinks from 304 KB to 102 KB after dead-code elimination).

Made-with: Cursor
2026-04-28 15:14:03 -05:00

27 lines
655 B
JSON

{
"name": "@tasks/collab-server",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsup",
"start": "node dist/index.mjs",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@hocuspocus/common": "^2.15.0",
"@hocuspocus/extension-database": "^2.15.0",
"@hocuspocus/extension-redis": "^2.15.0",
"@hocuspocus/server": "^2.15.0",
"@tasks/database": "workspace:*",
"drizzle-orm": "^0.38.0",
"ioredis": "^5.4.2",
"yjs": "^13.6.22",
"zod": "^3.24.0"
},
"devDependencies": {
"tsup": "^8.3.5",
"tsx": "^4.19.2",
"typescript": "^5.7.0"
}
}