From 0737f9d1e40c9b75ea61ab9cbb1effdd9fbfb84d Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Mon, 28 Oct 2024 13:34:41 +0100 Subject: [PATCH] Prefer `url.fileURLToPath ` Co-authored-by: Hendrik Liebau --- packages/next/src/server/patch-error-inspect.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/next/src/server/patch-error-inspect.ts b/packages/next/src/server/patch-error-inspect.ts index 522e350f32c154..2e96e413bb6b47 100644 --- a/packages/next/src/server/patch-error-inspect.ts +++ b/packages/next/src/server/patch-error-inspect.ts @@ -1,6 +1,6 @@ import { findSourceMap, type SourceMapPayload } from 'module' import * as path from 'path' -import { URL } from 'url' +import * as url from 'url' import type * as util from 'util' import { SourceMapConsumer as SyncSourceMapConsumer } from 'next/dist/compiled/source-map' import type { StackFrame } from 'next/dist/compiled/stacktrace-parser' @@ -38,7 +38,7 @@ function frameToString(frame: StackFrame): string { // In a multi-app repo, this leads to potentially larger file names but will make clicking snappy. // There's no tradeoff for the cases where `dir` in `next dev [dir]` is omitted // since relative to cwd is both the shortest and snappiest. - path.relative(process.cwd(), new URL(frame.file).pathname) + path.relative(process.cwd(), url.fileURLToPath(frame.file)) : frame.file return frame.methodName