-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[v13] relay-compiler generates require calls instead of top-level imports when eagerEsModules #3726
Comments
Hey @asterikx do you have an example repro? Or can you add an example of the generated file with the |
This is probably related to babel-plugin-relay rather than compiler |
The workaround is to add eagerESModules option in babel config |
The 13.0.1 with your fix is coming soon. |
No it's not babel-plugin-relay's fault. babel-plugin-relay only replaces the query strings in the files by the concrete requests. eagerESModules will only change the import style for that replacement. The imported file (the concrete request) still contains require calls (mostly on pagination fields I think). I will link a repo here in a few minutes. |
This is probably came from old tests where refetchable was implemented only for commonjs. |
We are still seeing this in v13.0.1, with pagination only. |
Actually, this appears to happen specifically with |
Ignore me, this is fixed in v13.0.2! 🙃 |
The generated files include
require
calls even when I specifyeagerEsModules: true
(previouslyeagerESModules
) inrelay.config.js
file.In
relay@12.0.0
,relay-compiler-language-typescript@15.0.0
generates top-level import statements instead of require calls if I specifyeagerESModules : true
. Inrelay@13.0.0
, this is no longer true.This prevents use with modern frontend tools, e.g. Vite, which do not transform
require
calls:Uncaught ReferenceError: require is not defined
.The text was updated successfully, but these errors were encountered: