facebook / facebook/relay

Explicitly require relay-runtime and make it a peerDep

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

Description

Today, the docs tell us to install 3 things: babel-plugin-relay, relay-compiler, and react-relay.

I propose we add relay-runtime to the list & make it a peerDep for relay-compiler & react-relay.

This solves 2 problems:
- `import {Environment} from 'relay-runtime'` won't throw errors in IDEs because relay-runtime doesn't exist in your package.json. Telling folks to import from a package that they didn't install makes beginners like me super confused.
- relay-compiler & react-relay both require relay-runtime & each installs a separate version themselves, for a total of 3 versions in your app! If you don't know this, developing locally can be a huge pain & discourage folks from making PRs (personally took me way too longer to figure out the relay-runtime i was editing wasn't the one being used by the compiler).

Happy to make a PR if you agree!

Contributor guide

Open the contributing guide

Research direction

Start with the installation documentation that currently lists babel-plugin-relay, relay-compiler, and react-relay, then inspect the package manifests for relay-compiler and react-relay. Done means the documentation explicitly includes relay-runtime and both packages declare it as a peer dependency, with the existing dependency behavior verified by the relevant project checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
developer-experience, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.