From bf8253c3528dfecd9d371840f139855c04e92ed8 Mon Sep 17 00:00:00 2001 From: PepijnSenders Date: Wed, 28 Apr 2021 16:34:38 -0700 Subject: [PATCH] Don't swallow MODULE_NOT_FOUND error --- .../next/next-server/server/load-components.ts | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/next/next-server/server/load-components.ts b/packages/next/next-server/server/load-components.ts index f7d361ef9c608..14ad0a11170f5 100644 --- a/packages/next/next-server/server/load-components.ts +++ b/packages/next/next-server/server/load-components.ts @@ -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,