From dfd67c237946f557e9ea01be3411abfc2c2c367f Mon Sep 17 00:00:00 2001 From: Jianhua Zheng Date: Tue, 7 Sep 2021 04:20:33 +0800 Subject: [PATCH] break up import keyword to avoid being accidentally parsed as dynamic import statement in external code (#21918) Co-authored-by: zhengjianhua --- 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' +