Require() of ES Module /lib/shape/Symbols.js not supported.
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Steps to reproduce
I’ve got these imports
import { Area, AreaChart, ResponsiveContainer, Tooltip, TooltipProps } from 'recharts';
import { NameType, ValueType } from 'recharts/types/component/DefaultTooltipContent';
What is expected?
v2.1.12 was ok, 2.1.13 got broke
What is actually happening?
Error [ERR_REQUIRE_ESM]: require() of ES Module /builds/projects/app/249311/node_modules/recharts/node_modules/d3-shape/src/index.js from /builds/projects/app/249311/node_modules/recharts/lib/shape/Symbols.js not supported.
Instead change the require of index.js in /builds/projects/app/249311/node_modules/recharts/lib/shape/Symbols.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/builds/projects/app/249311/node_modules/recharts/lib/shape/Symbols.js:14:16)
at Object.<anonymous> (/builds/projects/app/249311/node_modules/recharts/lib/component/DefaultLegendContent.js:16:16)
at Object.<anonymous> (/builds/projects/app/249311/node_modules/recharts/lib/component/Legend.js:16:29)
at Object.<anonymous> (/builds/projects/app/249311/node_modules/recharts/lib/index.js:317:15)
Environment | Info |
---|---|
Recharts | v2.1.13, v2.1.14 |
React | v18 |
System | debian bullseye |
Browser | n/a |
Issue Analytics
- State:
- Created a year ago
- Reactions:12
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Error: require() of ES module is no supported when using ...
Error: Must use import to load ES Module: project_path\node_modules\d3-shape\src\index.js require() of ES modules is not supported.
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The error "[ERR_REQUIRE_ESM]: require() of ES Module not supported. Instead change the require of index.js to a dynamic import() which is available in...
Read more >Using ES modules in Node.js - LogRocket Blog
With ES modules, modules are defined with the use of the import and export keywords instead of the require() function in CommonJS. Here...
Read more >Documentation - ECMAScript Modules in Node.js - TypeScript
This setting controls whether .js files are interpreted as ES modules or ... like require() and __dirname cannot be used directly; CommonJS modules...
Read more >JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax. A background on modules. JavaScript programs started off pretty ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes I do.
Can you explain why it must be fixed on the client side and not lib side?
I think you are using nextjs to build and not mention it ? in this case solved here: https://github.com/recharts/recharts/issues/2918#issuecomment-1263033336