fix: add __dirname polyfill for ES modules

- Import fileURLToPath from node:url
- Define __dirname using import.meta.url for ES module compatibility
- Fixes ReferenceError when serving static files in production

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-05-16 18:18:39 +07:00
parent 8e1f5adaa4
commit 70931576dc

View File

@@ -1,6 +1,7 @@
import fs from "node:fs"; import fs from "node:fs";
import http from "node:http"; import http from "node:http";
import path from "node:path"; import path from "node:path";
import { fileURLToPath } from "node:url";
import { Streamer } from "@dank074/discord-video-stream"; import { Streamer } from "@dank074/discord-video-stream";
import { AudioPlayerStatus } from "@discordjs/voice"; import { AudioPlayerStatus } from "@discordjs/voice";
import type { Client } from "discord.js-selfbot-v13"; import type { Client } from "discord.js-selfbot-v13";
@@ -25,6 +26,9 @@ import { createUIStateRoutes } from "./routes/uiStateRoutes";
import { createVoiceRoutes } from "./routes/voiceRoutes"; import { createVoiceRoutes } from "./routes/voiceRoutes";
import type { VoiceController } from "./voiceController"; import type { VoiceController } from "./voiceController";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const wsLogger = createChildLogger("webserver"); const wsLogger = createChildLogger("webserver");
const activeUsers = new Map< const activeUsers = new Map<