Skip to content

Commit

Permalink
Don't swallow MODULE_NOT_FOUND error
Browse files Browse the repository at this point in the history
  • Loading branch information
PepijnSenders committed Apr 28, 2021
1 parent a35dedb commit bf8253c
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions packages/next/next-server/server/load-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,9 @@ export async function loadComponents(
} as LoadComponentsReturnType
}

let DocumentMod
let AppMod
let ComponentMod

try {
DocumentMod = await requirePage('/_document', distDir, serverless)
AppMod = await requirePage('/_app', distDir, serverless)
ComponentMod = await requirePage(pathname, distDir, serverless)
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
throw new Error(`Failed to load ${pathname}`)
}
throw err
}
const DocumentMod = await requirePage('/_document', distDir, serverless)
const AppMod = await requirePage('/_app', distDir, serverless)
const ComponentMod = await requirePage(pathname, distDir, serverless)

const [
buildManifest,
Expand Down

0 comments on commit bf8253c

Please sign in to comment.