Open mjfaga opened 2 months ago
Out of curiosity, what makes you think this issue would be related to turbopack?
And a question more directly towards your issue at hand. Do you mind trying if this issue still persists if you strip the starting './' from the relay config -> output
@JesseKoldewijn
what makes you think this issue would be related to turbopack?
This is marked as related to Turbopack because as far as we can tell, the relay
compiler option in question executes a Turbopack swc plugin. Could have optionally said this was related to SWC instead, but it is a turbopack plugin so 🤷
Do you mind trying if this issue still persists if you strip the starting './' from the relay config -> output
This has no impact - the relay compiler is still attempting to run on the package in node_modules because excludes
is not respected. (Although perhaps related to your question - the generated directory does need to exist to run the build, will update the mvr repo shortly)
Link to the code that reproduces this issue
https://github.com/mjfaga/nextjs-relay-swc-excludes
To Reproduce
Install dependencies and build:
Current vs. Expected behavior
Current Behavior
When adding a library (in the MVP,
@stigg/react-sdk
) that uses GraphQL under the hood, the relay compiler breaks consumption of that library and the app no longer properly builds.Expected Behavior
No errors because node_modules is excluded from being targeted during relay GraphQL compilation (see below for additional context).
Provide environment information
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
The current SWC relay compiler implementation only supports 3 key options:
src
language
artifact_directory
exclude
is another critical option that is not currently supported. In the direct relay implementation, this is optional BUT ships with a default value of["**/node_modules/**", "**/mocks/**", "**/generated/**"]
to ensure things like packages in node_modules aren't targeted when they also happen to use GraphQL under the hood. In these cases, node_module source is recompiled, breaking those libraries.