facebook / facebook/relay

Relay without babel in 2021: Where do we stand with next-gen JS bundlers?

Open
#3,319 21 comments 30 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Last thread #828, [closed in Jan 2017](https://github.com/facebook/relay/issues/828#issuecomment-276164473) by @wincent with oppurtunity to reopen again.

In my projects, relay is the reason I'm sticking to babel at the moment, because I haven't been able to find any documented integrations of a babel-free setup where I could run relay, then have it go through a compiler.

In 2021, there is a growing assortment of alternatives to the babel+webpack setup such as [sucrase](https://github.com/alangpierce/sucrase), [esbuild](https://github.com/evanw/esbuild), [rome](https://github.com/rome/tools), [parcel](https://github.com/parcel-bundler/parcel), [swc](https://github.com/swc-project/swc) and [snowpack](https://github.com/snowpackjs/snowpack/) [*](https://github.com/snowpackjs/snowpack/discussions/824). Also, what about plain-old `tsc`?

The issue is, these bundlers often don't accept custom transformations, so I imagine there'd need to be a process happen where relay could run and the resulting code would be left in a state where it could be consumed by these bundlers that want very "Vanilla" code: They'll do TypeScript and JSX.

Where relay fits into the big picture of a project is still over my head (excuse me if I'm drastically misunderstanding and/or oversimplifying relay!) It would be helpful to illuminate what relay and the tools supported by [facebook/relay](https://github.com/facebook/relay) ingest, what they produce for us in terms of code generation, and any official supported ways interoperate with compilers/build systems/toolchains.

Questions:

- What would it take to get relay working with tools like vanilla `tsc`, sucrase, esbuild, rome, and swc?
- How much of the way does this project get us currently?
- Is there anything the maintainers could do to facilitate / document to make things clearer for us?
- What would be left for the community need to do to get relay working with next-gen bundlers?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.