diff --git a/src/resources/extensions/voice/index.ts b/src/resources/extensions/voice/index.ts index 3c5698fa1..69b0069f3 100644 --- a/src/resources/extensions/voice/index.ts +++ b/src/resources/extensions/voice/index.ts @@ -7,9 +7,10 @@ import * as fs from "node:fs"; import * as path from "node:path"; import * as readline from "node:readline"; -const SWIFT_SRC = path.join(__dirname, "speech-recognizer.swift"); -const RECOGNIZER_BIN = path.join(__dirname, "speech-recognizer"); -const PYTHON_SCRIPT = path.join(__dirname, "speech-recognizer.py"); +const __extensionDir = import.meta.dirname!; +const SWIFT_SRC = path.join(__extensionDir, "speech-recognizer.swift"); +const RECOGNIZER_BIN = path.join(__extensionDir, "speech-recognizer"); +const PYTHON_SCRIPT = path.join(__extensionDir, "speech-recognizer.py"); const IS_DARWIN = process.platform === "darwin"; const IS_LINUX = process.platform === "linux"; diff --git a/src/tests/extension-smoke.test.ts b/src/tests/extension-smoke.test.ts index cf41ecd7b..1177a09ce 100644 --- a/src/tests/extension-smoke.test.ts +++ b/src/tests/extension-smoke.test.ts @@ -26,9 +26,6 @@ const SKIP_EXTENSIONS = new Set([ // rewrites .js→.ts imports and fails because core.ts doesn't exist. // Works fine at runtime via jiti which loads core.js directly. "browser-tools", - // Uses __dirname at module scope — valid in CJS/jiti but crashes in ESM test runner. - // TODO: fix voice/index.ts to use import.meta.dirname or fileURLToPath(import.meta.url) - "voice", ]); test("all bundled extensions can be imported without throwing", async () => {