From b6fa6d1bb370e92792fa451a4d8b2b2cb01196c3 Mon Sep 17 00:00:00 2001 From: Vladislav Tarasov Date: Wed, 19 May 2021 20:32:40 +0300 Subject: [PATCH] Make caller optional --- packages/next/build/babel/plugins/react-loadable-plugin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/next/build/babel/plugins/react-loadable-plugin.ts b/packages/next/build/babel/plugins/react-loadable-plugin.ts index f6491aac59f3b1..0362243409a971 100644 --- a/packages/next/build/babel/plugins/react-loadable-plugin.ts +++ b/packages/next/build/babel/plugins/react-loadable-plugin.ts @@ -145,13 +145,14 @@ export default function ({ Import(importPath) { const importArguments = importPath.parentPath.get('arguments') if (!Array.isArray(importArguments)) return + const node: any = importArguments[0].node dynamicImports.push(node) dynamicKeys.push( t.binaryExpression( '+', t.stringLiteral( - (state.file.opts.caller.pagesDir + (state.file.opts.caller?.pagesDir ? relativePath( state.file.opts.caller.pagesDir, state.file.opts.filename