question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created a year ago
  • Reactions:12
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
simPodcommented, Oct 12, 2022

Yes I do.

Can you explain why it must be fixed on the client side and not lib side?

1reaction
jmfrancoiscommented, Oct 12, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found