Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix TypeError _interopRequireDefault is not a function in Create React App

Tags:

reactjs

I'm trying to use Create React App on Codesandbox.io but I keep receiving TypeError _interopRequireDefault is not a function import ReactDOM from "react-dom";

Please let me know how I can fix this, thank you.

like image 910
ln09nv2 Avatar asked Feb 23 '21 04:02

ln09nv2


3 Answers

After add "@babel/runtime", I fixed it

like image 117
Sangwon Jeon Avatar answered Nov 18 '22 02:11

Sangwon Jeon


In my case the solution was to clean jest cache:

npx jest --clearCache
like image 26
myrs Avatar answered Nov 18 '22 01:11

myrs


Add @babel/runtime to the dependency section. That will fix it.

like image 6
Harsh Deshpande Avatar answered Nov 18 '22 01:11

Harsh Deshpande