Spaces:
Paused
Paused
fix(build): switch to CommonJS format for Express compatibility
Browse filesESM format causes "Dynamic require of path is not supported" error
because Express and its dependencies use CommonJS require().
Switch to CJS output format and use .cjs extension.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Dockerfile +1 -1
- apps/backend/Dockerfile.hf +1 -1
- apps/backend/package.json +1 -1
Dockerfile
CHANGED
|
@@ -47,4 +47,4 @@ ENV NODE_ENV=production
|
|
| 47 |
ENV PORT=7860
|
| 48 |
|
| 49 |
EXPOSE 7860
|
| 50 |
-
CMD ["node", "dist/index.
|
|
|
|
| 47 |
ENV PORT=7860
|
| 48 |
|
| 49 |
EXPOSE 7860
|
| 50 |
+
CMD ["node", "dist/index.cjs"]
|
apps/backend/Dockerfile.hf
CHANGED
|
@@ -47,4 +47,4 @@ ENV NODE_ENV=production
|
|
| 47 |
ENV PORT=7860
|
| 48 |
|
| 49 |
EXPOSE 7860
|
| 50 |
-
CMD ["node", "dist/index.
|
|
|
|
| 47 |
ENV PORT=7860
|
| 48 |
|
| 49 |
EXPOSE 7860
|
| 50 |
+
CMD ["node", "dist/index.cjs"]
|
apps/backend/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
"scripts": {
|
| 7 |
"dev": "tsx watch src/index.ts",
|
| 8 |
"build": "esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.js --external:@prisma/client --external:better-sqlite3 --external:pg-native --external:@xenova/transformers --external:onnxruntime-node --external:sharp --external:canvas --format=esm",
|
| 9 |
-
"build-fixed": "esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.
|
| 10 |
"build:tsc": "tsc",
|
| 11 |
"start": "node dist/index.js",
|
| 12 |
"test": "vitest run",
|
|
|
|
| 6 |
"scripts": {
|
| 7 |
"dev": "tsx watch src/index.ts",
|
| 8 |
"build": "esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.js --external:@prisma/client --external:better-sqlite3 --external:pg-native --external:@xenova/transformers --external:onnxruntime-node --external:sharp --external:canvas --format=esm",
|
| 9 |
+
"build-fixed": "esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.cjs --external:@prisma/client --external:better-sqlite3 --external:pg-native --external:@xenova/transformers --external:onnxruntime-node --external:sharp --external:canvas --format=cjs",
|
| 10 |
"build:tsc": "tsc",
|
| 11 |
"start": "node dist/index.js",
|
| 12 |
"test": "vitest run",
|