Skip to content
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

babel-plugin-relay and relay-compiler are not compatible with ES6 modules #2445

Open
bahador opened this issue May 13, 2018 · 10 comments
Open
Labels

Comments

@bahador
Copy link

bahador commented May 13, 2018

The output of using babel-plugin-relay uses require, and the output of relay-compiler uses module.exports.

I'd like to request that there be an option to use ES6 import statements instead of require and that relay-compiler output ES6 modules.

TIA.

@kortac
Copy link

kortac commented Jul 16, 2018

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.

@TrySound
Copy link
Contributor

@kortac
Copy link

kortac commented Jul 16, 2018

@TrySound Thanks, but I'm already using this rollup plugin after the rollup babel plugin and it's not replacing the require-calls.

@bahador
Copy link
Author

bahador commented Jul 16, 2018

@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.

@TrySound
Copy link
Contributor

Could you provide reproducing repo where commonjs plugin doesn't work?

@alloy
Copy link
Contributor

alloy commented Jul 17, 2018

My language plugin PR also happens to fix (part of) this situation, but the overall scope of that PR is a bit larger #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.

adeira-github-bot pushed a commit to adeira/relay-example that referenced this issue Sep 9, 2019
Inspired by:

- facebook/relay#2445
- facebook/relay#2781
- facebook/relay#2841

kiwicom-source-id: a0181e85ec323a361502ef8275739cf18ef114ac
adeira-github-bot pushed a commit to kiwicom/relay that referenced this issue Sep 9, 2019
Inspired by:

- facebook/relay#2445
- facebook/relay#2781
- facebook/relay#2841

kiwicom-source-id: a0181e85ec323a361502ef8275739cf18ef114ac
@stale
Copy link

stale bot commented Dec 25, 2020

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.

@theseyi
Copy link

theseyi commented Jan 3, 2021

This seems related to #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

@stale stale bot removed the wontfix label Jan 3, 2021
@TrySound
Copy link
Contributor

TrySound commented Jan 3, 2021

Yes, enable eagerESModules option in relay config.

@stale
Copy link

stale bot commented Jan 9, 2022

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.

@stale stale bot added the wontfix label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants