@samitouri / QOS-React-2 / commits / b8884de24e

break up import keyword to avoid being accidentally parsed as dynamic import statement in external code (#21918)

Co-authored-by: zhengjianhua <zhengjianhua.michael@bytedance.com>

Jianhua Zheng committed Sep 7, 2021 at 04:20 UTC b8884de24e2ca7ff2c05d9c5e9d06470816b60c2
1 file changed +4 -2
packages/react/src/ReactLazy.js
+4 -2
@@ -88,7 +88,8 @@ function lazyInitializer<T>(payload: Payload<T>): T {
88 if (__DEV__) {
89 if (moduleObject === undefined) {
90 console.error(
91 - 'lazy: Expected the result of a dynamic import() call. ' +
91 + 'lazy: Expected the result of a dynamic imp' +
92 + 'ort() call. ' +
93 'Instead received: %s\n\nYour code should look like: \n ' +
94 // Break up imports to avoid accidentally parsing them as dependencies.
95 'const MyComponent = lazy(() => imp' +
@@ -101,7 +102,8 @@ function lazyInitializer<T>(payload: Payload<T>): T {
102 if (__DEV__) {
103 if (!('default' in moduleObject)) {
104 console.error(
104 - 'lazy: Expected the result of a dynamic import() call. ' +
105 + 'lazy: Expected the result of a dynamic imp' +
106 + 'ort() call. ' +
107 'Instead received: %s\n\nYour code should look like: \n ' +
108 // Break up imports to avoid accidentally parsing them as dependencies.
109 'const MyComponent = lazy(() => imp' +