apollographql / apollographql/apollo-client-integrations
Error 'ERR_REQUIRE_ESM' with "@apollo/experimental-nextjs-app-support"
- Dominant language
- TypeScript
- Stars
- 556
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Hi Maintainers,
I'm running into `ERR_REQUIRE_ESM` error when using it in my Next.js api route to load data (` unhandledRejection: Error [ERR_REQUIRE_ESM]: require() of ES Module `).
The issue seemed to be tied with `[superjson ^2.0.0](https://github.com/blitz-js/superjson/releases)` where it introduced a new change to make it ESM only:

=============================================
**I have worked around the issue by manually setting `superjson` version to 1.13.3 but just thought I should raise it here that the version specification should probably not include `^2.0.0` until it loads the module in ESM format.**
Thanks for your attention
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting the dependency specification for superjson and the Next.js API route entry point where ERR_REQUIRE_ESM occurs. Reproduce the error with superjson 2.x, then verify that the dependency range and module loading behavior work without the reported failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100