DEV Community

Ajith
Ajith

Posted on

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)