fix: replace undefined __dirname with DATA_DIR in ESM server
Browse files__dirname was removed during utils.ts extraction but still referenced
in staticDir computation, causing a ReferenceError crash on startup.
Made-with: Cursor
- backend/src/server.ts +2 -2
backend/src/server.ts
CHANGED
|
@@ -351,8 +351,8 @@ app.use("/published", express.static(join(DATA_DIR, "published")));
|
|
| 351 |
|
| 352 |
const staticDir =
|
| 353 |
process.env.NODE_ENV === "production"
|
| 354 |
-
? join(
|
| 355 |
-
: join(
|
| 356 |
|
| 357 |
function getPublishedPath(docName: string): string {
|
| 358 |
return join(DATA_DIR, "published", docName, "index.html");
|
|
|
|
| 351 |
|
| 352 |
const staticDir =
|
| 353 |
process.env.NODE_ENV === "production"
|
| 354 |
+
? join(DATA_DIR, "..", "frontend-dist")
|
| 355 |
+
: join(DATA_DIR, "..", "..", "frontend", "dist");
|
| 356 |
|
| 357 |
function getPublishedPath(docName: string): string {
|
| 358 |
return join(DATA_DIR, "published", docName, "index.html");
|