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
Bundling error when used with NextJS #1826
Comments
This comes down to loading a named adaptor: crystal/graphile-build/graphile-build-pg/src/pgServices.ts Lines 29 to 49 in 7ff3d50
Ideally we'd pass the adaptor directly, but I have a feeling we're doing TypeScript stuff involving the adaptor name so it might be a bit of effort. That's what we should do though. If anyone fancies tearing out this code and replacing it with passing the adaptor directly via the configuration (so the user explicitly imports it themself) and also updating the documentation in the various places it's referenced, that would be appreciated 👍 |
Relates to #1985 |
@tim-field did you find a workaround to this issue? |
We're working around the issue by marking dependencies as external: /** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
esmExternals: true,
serverComponentsExternalPackages: [
"grafast",
"grafserv",
"graphile-export",
"graphql",
"postgraphile",
"ruru",
],
},
}; |
Summary
Unable to import postgraphile (v5) or grafast in an next js project.
Attempting to setup a route that includes postgraphile v5 but next refuses to bundle
Steps to reproduce
Create a new next js app using
npx create-next-app@latest
install postgrahile@beta I was using
^5.0.0-beta.15
Attempt to setup a route which imports postgraphile
Expected results
Next js able to complile / bundle
Actual results
A bundling error
Additional context
@benjie thinks this is a bundling error
https://discord.com/channels/489127045289476126/1165551144299401317/1165574782675329056
Possible Solution
The text was updated successfully, but these errors were encountered: