1

Failed to compile.

Error in ./src/App.js Syntax error: Unexpected token (11:31)

   9 | import Fastfood from "./Fastfood";
  10 | import Billing from "./Billing";
> 11 | const Fruit = React.lazy(() => import("./Fruit"));
     |                                ^
  12 | const App = () => {
  13 |   const isLogin = true;
  14 | 

@ ./src/index.js 13:11-27

1 Answer 1

2

You can add babel-plugin-syntax-dynamic-import by running this command:

npm install --save-dev babel-plugin-syntax-dynamic-import

then add it to your babel (ie: .babelrc file) configuration:

{
  "plugins": ["syntax-dynamic-import"]
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.