Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 'ERR_REQUIRE_ESM' with "@apollo/experimental-nextjs-app-support" #233

Open
kcy1860 opened this issue Mar 7, 2024 · 3 comments
Open

Comments

@kcy1860
Copy link

kcy1860 commented Mar 7, 2024

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:
image

=============================================

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

@phryneas
Copy link
Member

phryneas commented Mar 8, 2024

Yeah, that's a bit of a weird issue, that irritatingly only shows up in specific bundler combinations used by Next.js (not for all kinds of builds).

We are planning to drop the SuperJSON dependency completely, as it adds way too much bundle size and bloats the transported data unneccessarily - you can subscribe to #209 to track that.

@elmaedesistemas
Copy link

hi, news about this?

@phryneas
Copy link
Member

@elmaedesistemas We will handle that in about two releases (targeting 0.11, with 0.9 hopefully going out today or tomorrow).

That said, our package allows for usage with both superjson 1 and 2, and you can configure your package.json to explicitly use one of them over the other (npm: overrides, yarn: resolutions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants