vercel / vercel/nft

Missing ESM dependencies in standalone bundle

Open
#560 3 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
185
PR merge metrics
No merged PRs in 30d

Description

👋 Hello from Recharts!

We have this problem where Recharts fails to build using next.js standalone.

The situation is:

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: https://github.com/recharts/recharts/issues/6117#issuecomment-3688967008

Here's a reproduction: https://github.com/recharts/recharts-integ/pull/88

Do you have any recommendation what can we do to have everything compile in nextjs? Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction in recharts-integ pull request 88 and run next build && node .next/standalone/server.js to reproduce the missing dependencies. Trace how the standalone build discovers Recharts and Redux Toolkit ESM files; done when the standalone server runs without manually copying files.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, redux
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.