Skip to content

Commit

Permalink
break up import keyword to avoid being accidentally parsed as dynamic…
Browse files Browse the repository at this point in the history
… import statement in external code (#21918)

Co-authored-by: zhengjianhua <zhengjianhua.michael@bytedance.com>
  • Loading branch information
headwindz and headwindz committed Sep 6, 2021
1 parent 6d6bba5 commit b8884de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react/src/ReactLazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ function lazyInitializer<T>(payload: Payload<T>): 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' +
Expand All @@ -101,7 +102,8 @@ function lazyInitializer<T>(payload: Payload<T>): 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' +
Expand Down

0 comments on commit b8884de

Please sign in to comment.