Open bahador opened 6 years ago
Is there a workaround for this? I'm using rollup to bundle my package and babel-plugin-relay
breaks the bundle as it adds require
-calls to the code.
@SpaceHeroGuide https://github.com/rollup/rollup-plugin-commonjs
@TrySound Thanks, but I'm already using this rollup plugin after the rollup babel plugin and it's not replacing the require
-calls.
@SpaceHeroGuide is correct. This is not an issue that rollup-plugin-commonjs
can solve. One solution would be to have a flag to output ES6 modules instead of using require
and module.exports
. I looked into fixing this myself and submitting a PR, but this isn't my area of expertise.
Could you provide reproducing repo where commonjs plugin doesn't work?
My language plugin PR also happens to fix (part of) this situation, but the overall scope of that PR is a bit larger https://github.com/facebook/relay/pull/2293
Specifically what it does is look for a default export. The exports from the artifacts, though, are left up to the specific language plugin to define, which in the case of JS/Flow would remain the same as currently the case is.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This seems related to https://github.com/facebook/relay/issues/2706 which is also as yet unresolved. Has the community found a sustainable solution to this yet? I'm using rollupjs and ran into this yesterday as well
Yes, enable eagerESModules option in relay config.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The output of using
babel-plugin-relay
usesrequire
, and the output ofrelay-compiler
usesmodule.exports
.I'd like to request that there be an option to use ES6
import
statements instead ofrequire
and thatrelay-compiler
output ES6 modules.TIA.