close

[Solved] require() of ES modules is not supported using recharts

Are You Facing the Following error require() of ES modules is not supported using recharts in ReactJs? Then You are in right place. In this article, we will try to figure out how this error occurs and what are the possible fixes for this error. First of all, let’s explore how this error occurs.

What is require() of ES modules is not supported using recharts error?

I am using recharts package in my reactjs app and I am facing the following error.

Error: Must use import to load ES Module:
require() of ES modules is not supported.

How To Fix require() of ES modules is not supported using recharts Error?

  1. How To Fix require() of ES modules is not supported using recharts Error?

    To Fix require() of ES modules is not supported using recharts Error

  2. require() of ES modules is not supported using recharts

    There are some errors with recharts package To Fix require() of ES modules is not supported using recharts Error You just need to downgrade your recharts with the 2.1.12 version. Just open your package.json file and replace recharts line with this: “recharts “: “2.1.12” And now, Your error will be solved.

Solution 1: Downgrade recharts

There are some errors with recharts package To Fix require() of ES modules is not supported using recharts Error You just need to downgrade your recharts with the 2.1.12 version. Just open your package.json file and replace recharts line with this.

"recharts ": "2.1.12"  #Dont use ^2.1.12

And now, Your error will be solved.

Conclusion

It’s all About this error. I hope We Have solved Your error. Comment below Your thoughts and your queries. Also, Comment below on which solution worked for you.

Also, Read

Leave a Comment