DEV Community

Ajith
Ajith

Posted on

1 1

npm run build fails for create react app with dynamic imports and external modules

I have a few dynamic imports and external js called in the javascript create react app.

It works fine when I use npm run start
When I try to create a build using npm run build, i get the following error and the build fails.

The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script.

I am still trying to figure out the webpack's, the babel's and the right way to deploy. In case you have any resources that can help me get away this error and understand the basics I would be happy.

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay