Skip to content

Commit 5ed627e

Browse files
committed
fix: server startup failures in Node 24
- Remove unused MapWithMode type in MapPlaylist.ts (TS2304 error) - Make Client.ws mutable to allow reassignment on rejoin (TS2540 error) - Add cluster.setupPrimary() for ESM compatibility in Node 24
1 parent 59cbd38 commit 5ed627e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/server/Client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class Client {
1818
public readonly flares: string[] | undefined,
1919
public readonly ip: string,
2020
public readonly username: string,
21-
public readonly ws: WebSocket,
21+
public ws: WebSocket,
2222
public readonly walletAddress: string | null,
2323
public readonly cosmetics: PlayerCosmetics | undefined,
2424
public readonly isRejoin: boolean = false,

src/server/MapPlaylist.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ const frequency: Partial<Record<GameMapName, number>> = {
4545
};
4646

4747
export class MapPlaylist {
48-
private mapsPlaylist: MapWithMode[] = [];
49-
5048
constructor(private disableTeams: boolean = false) {}
5149

5250
public gameConfig(): GameConfig {

src/server/Server.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import cluster from "cluster";
22
import * as dotenv from "dotenv";
3+
import { fileURLToPath } from "url";
34
import { GameEnv } from "../core/configuration/Config";
45
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
56
import { Cloudflare, TunnelConfig } from "./Cloudflare";
@@ -10,6 +11,13 @@ import { startWorker } from "./Worker";
1011
// Load environment variables FIRST
1112
dotenv.config();
1213

14+
// Setup cluster for ESM - required for Node 24+ with ESM loaders
15+
if (cluster.isPrimary) {
16+
cluster.setupPrimary({
17+
exec: fileURLToPath(import.meta.url),
18+
});
19+
}
20+
1321
const config = getServerConfigFromServer();
1422

1523
// Validate environment variables based on the current environment

0 commit comments

Comments
 (0)