From 2640083996ea98a266d2cc98d7836a6dbf738d28 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 25 Sep 2024 20:33:03 +0200 Subject: [PATCH] fix: normalize resolved path --- src/builders/rollup/stub.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/builders/rollup/stub.ts b/src/builders/rollup/stub.ts index 8f969506..d9e54239 100644 --- a/src/builders/rollup/stub.ts +++ b/src/builders/rollup/stub.ts @@ -1,7 +1,7 @@ import { writeFile, mkdir } from "node:fs/promises"; import { promises as fsp } from "node:fs"; -import { resolve, dirname, normalize, extname, relative } from "pathe"; -import { resolvePath, resolveModuleExportNames } from "mlly"; +import { resolve, dirname, extname, relative } from "pathe"; +import { resolvePath, resolveModuleExportNames, fileURLToPath } from "mlly"; import { warn } from "../../utils"; import type { BuildContext } from "../../types"; import { makeExecutable, getShebang } from "./plugins/shebang"; @@ -65,9 +65,7 @@ export async function rollupStub(ctx: BuildContext): Promise { ); const isESM = ctx.pkg.type === "module"; - const resolvedEntry = normalize( - ctx.jiti.esmResolve(entry.input, { try: true }) || entry.input, - ); + const resolvedEntry = fileURLToPath(ctx.jiti.esmResolve(entry.input)!); const resolvedEntryWithoutExt = resolvedEntry.slice( 0, Math.max(0, resolvedEntry.length - extname(resolvedEntry).length),