Fix Passenger ESM incompatibility — add server.cjs CJS wrapper

Passenger's node-loader uses require() which cannot load ES modules.
server.cjs is a CommonJS shim that bridges into server.js via dynamic import().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Leon Serfaty
2026-04-26 16:49:13 -04:00
co-authored by Claude Sonnet 4.6
parent e91ff1ce89
commit 8656e6e470
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
"dev:api": "npm run dev -w apps/api", "dev:api": "npm run dev -w apps/api",
"build": "npm run build -w apps/web", "build": "npm run build -w apps/web",
"build:check": "npm run build && npm run typecheck", "build:check": "npm run build && npm run typecheck",
"start": "node server.js", "start": "node server.cjs",
"db:generate": "npm run generate -w packages/db", "db:generate": "npm run generate -w packages/db",
"db:migrate": "npm run migrate -w packages/db", "db:migrate": "npm run migrate -w packages/db",
"typecheck": "npm run typecheck --workspaces --if-present" "typecheck": "npm run typecheck --workspaces --if-present"
+7
View File
@@ -0,0 +1,7 @@
// CommonJS wrapper for Phusion Passenger.
// Passenger's node-loader uses require(), which cannot load ES modules directly.
// This shim bridges into the ESM entry point via dynamic import().
import('./server.js').catch((err) => {
console.error(err);
process.exit(1);
});