diff --git a/packages/next/src/client/components/react-dev-overlay/server/middleware.ts b/packages/next/src/client/components/react-dev-overlay/server/middleware.ts index 451601e4978c8..aa081c29fb87d 100644 --- a/packages/next/src/client/components/react-dev-overlay/server/middleware.ts +++ b/packages/next/src/client/components/react-dev-overlay/server/middleware.ts @@ -111,7 +111,7 @@ export async function createOriginalStackFrame({ rootDirectory: string frame: StackFrame errorMessage?: string -}): Promise { +}): Promise { const { lineNumber, column } = frame const moduleNotFound = findModuleNotFoundFromError(errorMessage) const result = await (async () => { @@ -134,7 +134,7 @@ export async function createOriginalStackFrame({ })() if (!result?.sourcePosition.source) { - return undefined + return null } const { sourcePosition, sourceContent } = result diff --git a/packages/next/src/server/lib/router-utils/setup-dev-bundler.ts b/packages/next/src/server/lib/router-utils/setup-dev-bundler.ts index aa5d18e1b7373..d0fb87f772ad2 100644 --- a/packages/next/src/server/lib/router-utils/setup-dev-bundler.ts +++ b/packages/next/src/server/lib/router-utils/setup-dev-bundler.ts @@ -74,6 +74,7 @@ import { batchedTraceSource, createOriginalStackFrame as createOriginalTurboStackFrame, } from '../../../client/components/react-dev-overlay/server/middleware-turbopack' +import type { OriginalStackFrameResponse } from '../../../client/components/react-dev-overlay/server/shared' import { devPageFiles } from '../../../build/webpack/plugins/next-types-plugin/shared' import type { LazyRenderServerInstance } from '../router-server' import { HMR_ACTIONS_SENT_TO_BROWSER } from '../../dev/hot-reloader-types' @@ -955,7 +956,8 @@ async function startWatcher(opts: SetupOpts) { !file?.includes('') ) - let originalFrame, isEdgeCompiler + let originalFrame: OriginalStackFrameResponse | null = null + let isEdgeCompiler = false const frameFile = frame?.file if (frame?.lineNumber && frameFile) { if (hotReloader.turbopackProject) {