From fc9aeaecaeca80debb77229701a341479ed477a2 Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Thu, 20 Aug 2020 01:15:15 -0400 Subject: [PATCH] Calculate `isNextExternal` unconditional of `isLocal` --- packages/next/build/webpack-config.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index 857ca1360fac0..052c3c4888a67 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -623,17 +623,13 @@ export default async function getBaseWebpackConfig( return callback() } - let isNextExternal: boolean = false - if (isLocal) { - // we need to process next-server/lib/router/router so that - // the DefinePlugin can inject process.env values - isNextExternal = /next[/\\]dist[/\\]next-server[/\\](?!lib[/\\]router[/\\]router)/.test( - res - ) - - if (!isNextExternal) { - return callback() - } + // we need to process next-server/lib/router/router so that + // the DefinePlugin can inject process.env values + const isNextExternal = /next[/\\]dist[/\\]next-server[/\\](?!lib[/\\]router[/\\]router)/.test( + res + ) + if (isLocal && !isNextExternal) { + return callback() } // `isNextExternal` special cases Next.js' internal requires that