facebook / facebook/relay

[relay-compiler] --persist-output in 2.0.0 creates empty query map

Open
#2,650 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I'm using relay-compiler@2.0.0 without watch mode, and while initially everything worked fine with the correct query map being generated, after updating one of the relay fragment queries, the compiler simply produces an empty object. It looks like I have to completely delete the map file, then it will be recreated correctly on the next run of relay-compiler.

My compile command looks as follows:

relay-compiler --watchman false --src ./frontend --schema ./schema/schema.graphql --persist-output ./schema/persistedQueries.json --exclude ./src/relay-utils.js

This issue looks similar to #2625, however in my case, I explicitly am not operating in watch mode and would expect the file to get recreated correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with relay-compiler@2.0.0 using the shown command, schema/schema.graphql, frontend, and schema/persistedQueries.json. Update a Relay fragment and rerun the compiler without watch mode; done means the persisted query map is regenerated with the expected entries instead of becoming an empty object, without deleting the existing map first.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.