From 9ec0666b63bf27e04c831a595e53cfc4f4d9be54 Mon Sep 17 00:00:00 2001 From: zhengjianhua Date: Tue, 20 Jul 2021 10:28:30 +0800 Subject: [PATCH] break up import keyword to avoid being accidentally parsed as dynamic import statement in external code --- packages/react/src/ReactLazy.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react/src/ReactLazy.js b/packages/react/src/ReactLazy.js index 0bc05df6411cd..a132e1b5691ff 100644 --- a/packages/react/src/ReactLazy.js +++ b/packages/react/src/ReactLazy.js @@ -88,7 +88,8 @@ function lazyInitializer(payload: Payload): T { if (__DEV__) { if (moduleObject === undefined) { console.error( - 'lazy: Expected the result of a dynamic import() call. ' + + 'lazy: Expected the result of a dynamic imp' + + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. 'const MyComponent = lazy(() => imp' + @@ -101,7 +102,8 @@ function lazyInitializer(payload: Payload): T { if (__DEV__) { if (!('default' in moduleObject)) { console.error( - 'lazy: Expected the result of a dynamic import() call. ' + + 'lazy: Expected the result of a dynamic imp' + + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. 'const MyComponent = lazy(() => imp' +