Skip to content

Commit

Permalink
fix: normalize resolved path
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 25, 2024
1 parent 40674c9 commit 2640083
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/builders/rollup/stub.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -65,9 +65,7 @@ export async function rollupStub(ctx: BuildContext): Promise<void> {
);

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),
Expand Down

0 comments on commit 2640083

Please sign in to comment.