-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Description
👋 Hello from Recharts!
We have this problem where Recharts fails to build using next.js standalone.
The situation is:
- Recharts provides both ESM and CJS bundles (https://github.com/recharts/recharts/blob/main/package.json)
- Recharts depends on Redux toolkit, which also provides both ESM and CJS bundles (https://github.com/reduxjs/redux-toolkit/blob/master/packages/toolkit/package.json)
- All works fine when using
next devbut fails to run when usingnext build && node .next/standalone/server.js
The cause seems to be that the Recharts code is referencing redux/toolkit ESM bundle but those files are not included in the standalone build. Copying the appropriate files to the standalone folder fixes it.
Also adding exports to Recharts package.json would fix this - but it breaks so many other places that we can't do that just yet.
Here's a summary with more details: recharts/recharts#6117 (comment)
Here's a reproduction: recharts/recharts-integ#88
Do you have any recommendation what can we do to have everything compile in nextjs? Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels