diff --git a/src/channels/plugins/module-loader.test.ts b/src/channels/plugins/module-loader.test.ts index 0487eac5f83..e895e9859c7 100644 --- a/src/channels/plugins/module-loader.test.ts +++ b/src/channels/plugins/module-loader.test.ts @@ -46,15 +46,17 @@ describe("channel plugin module loader helpers", () => { it("resolves plugin module candidates and picks the first existing extension", () => { const rootDir = createTempDir(); - const expectedPath = path.join(rootDir, "src", "checker.mjs"); + const expectedPath = path.join(rootDir, "src", "checker.mts"); fs.mkdirSync(path.dirname(expectedPath), { recursive: true }); fs.writeFileSync(expectedPath, "export const ok = true;\n", "utf8"); expect(resolvePluginModuleCandidates(rootDir, "./src/checker")).toEqual([ path.join(rootDir, "src", "checker"), path.join(rootDir, "src", "checker.ts"), + path.join(rootDir, "src", "checker.mts"), path.join(rootDir, "src", "checker.js"), path.join(rootDir, "src", "checker.mjs"), + path.join(rootDir, "src", "checker.cts"), path.join(rootDir, "src", "checker.cjs"), ]); expect(resolveExistingPluginModulePath(rootDir, "./src/checker")).toBe(expectedPath); diff --git a/src/channels/plugins/module-loader.ts b/src/channels/plugins/module-loader.ts index f54388679ce..9fe38f634a8 100644 --- a/src/channels/plugins/module-loader.ts +++ b/src/channels/plugins/module-loader.ts @@ -53,8 +53,10 @@ export function resolvePluginModuleCandidates(rootDir: string, specifier: string return [ resolvedPath, `${resolvedPath}.ts`, + `${resolvedPath}.mts`, `${resolvedPath}.js`, `${resolvedPath}.mjs`, + `${resolvedPath}.cts`, `${resolvedPath}.cjs`, ]; }