ln09nv2
ln09nv2

Reputation: 1343

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

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.

Upvotes: 29

Views: 22487

Answers (5)

Ali Hassan
Ali Hassan

Reputation: 11

I used flowbite-react a library of tailwind and while they have given

import Link from 'next/link';

for Navbar code just replace this with

import { Link } from "react-router-dom";

problem would be solvd

Upvotes: 1

jay pithava
jay pithava

Reputation: 11

Add the below dependency in your main package.json file to solve that issue.

"@babel/runtime": "^7.15.4", "metro-react-native-babel-preset": "^0.69.0",

Upvotes: 1

myrs
myrs

Reputation: 747

In my case the solution was to clean jest cache:

npx jest --clearCache

Upvotes: 57

Harsh Deshpande
Harsh Deshpande

Reputation: 61

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

Upvotes: 6

Sangwon Jeon
Sangwon Jeon

Reputation: 146

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

Upvotes: 13

Related Questions