Don't swallow MODULE_NOT_FOUND error (#24577)
## Bug - [x] Related issues linked using [`fixes #24328`](https://github.com/vercel/next.js/pull/24328#issuecomment-828847472) - [ ] Integration tests added The change in #24328 will swallow any `MODULE_NOT_FOUND` errors triggered in the page. If you for example have a page with a broken import, it will tell you `Error: Failed to load /whatever`. This of course doesn't really tell people what is going on internally (a broken import). I added a check to see if the error actually happened in the page.
This commit is contained in:
parent
e783b0a2e8
commit
d5de1c53c1
1 changed files with 3 additions and 14 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue