From 8efae103783f669ba8d6734f3041a83957fe6e66 Mon Sep 17 00:00:00 2001 From: MrPiglr Date: Thu, 12 Feb 2026 15:10:41 -0700 Subject: [PATCH] fix(build): output server bundle as .cjs for ES module compatibility - Change server output from index.js to index.cjs - Update start script to run index.cjs - Fixes 'module is not defined' error on Railway - CommonJS format explicit with .cjs extension Resolves module format conflict where package.json has 'type: module' but server bundle uses CommonJS format --- package.json | 2 +- script/build.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ee0fd41..a668211 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "cap:live-reload:ios": "tsx script/capacitor-live-reload.ts --ios", "cap:production": "tsx script/capacitor-production.ts", "dev:mobile": "npm run cap:live-reload && concurrently \"npm run dev\" \"echo 'Dev server started. Open Android Studio or Xcode to run the app.'\"", - "start": "cross-env NODE_ENV=production node dist/index.js", + "start": "cross-env NODE_ENV=production node dist/index.cjs", "check": "tsc", "db:push": "drizzle-kit push", "tauri": "cd shell/aethex-shell && npm run tauri", diff --git a/script/build.ts b/script/build.ts index e4de3cd..9eeac97 100644 --- a/script/build.ts +++ b/script/build.ts @@ -61,7 +61,7 @@ async function buildAll() { platform: "node", bundle: true, format: "cjs", - outfile: "dist/index.js", + outfile: "dist/index.cjs", define: { "process.env.NODE_ENV": '"production"', },