-
Notifications
You must be signed in to change notification settings - Fork 2k
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
TypeError: module.require is not a function
error when running with turbopack
#8004
Comments
I wanted to look into this, but when I checked out @MersadHabibi's linked repo and ran
I'd be happy to look in more detail given a full detailed reproduction that requires no creativity on my part. Though it does seem likely that this is just some overzealous optimization on "turbopack"'s part? |
That said, I see |
Apparently Next.JS "Turbopack" runs code in a weird semi-Node environment that doesn't have module.require. We don't want to call require directly because that makes other bundlers put in polyfills. So make Turbopack use sha.js instead of just throwing. Non-ideal but better than what we have today. For apollographql/apollo-server#8004
use |
Issue Description
Apologies if this should be an FR, or an issue on a different project. I'm finding it hard to work out if nextjs + turbopack + apollo server is supposed to be supported or not, and what's stopping it from working at the moment.
In any case, when trying to run
next dev --turbo
on a project with apollo server, I get a bunch ofTypeError: module.require is not a function
errors whenever the gql endpoint is hit, and no data is returned. Running without--turbo
(i.e. using webpack) works fine.Related issues:
apollo-server-integrations/apollo-server-integration-next#172
apollo-server-integrations/apollo-server-integration-next#232
vercel/next.js#72573
Thanks
Link to Reproduction
See vercel/next.js#72573
Reproduction Steps
See vercel/next.js#72573
The text was updated successfully, but these errors were encountered: