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
This commit is contained in:
MrPiglr 2026-02-12 15:10:41 -07:00
parent 36a7305cf6
commit 8efae10378
2 changed files with 2 additions and 2 deletions

View file

@ -18,7 +18,7 @@
"cap:live-reload:ios": "tsx script/capacitor-live-reload.ts --ios", "cap:live-reload:ios": "tsx script/capacitor-live-reload.ts --ios",
"cap:production": "tsx script/capacitor-production.ts", "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.'\"", "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", "check": "tsc",
"db:push": "drizzle-kit push", "db:push": "drizzle-kit push",
"tauri": "cd shell/aethex-shell && npm run tauri", "tauri": "cd shell/aethex-shell && npm run tauri",

View file

@ -61,7 +61,7 @@ async function buildAll() {
platform: "node", platform: "node",
bundle: true, bundle: true,
format: "cjs", format: "cjs",
outfile: "dist/index.js", outfile: "dist/index.cjs",
define: { define: {
"process.env.NODE_ENV": '"production"', "process.env.NODE_ENV": '"production"',
}, },