Skip to content

Fix error-codes not updating correctly#10348

Merged
gaearon merged 2 commits intofacebook:masterfrom
thymikee:error-codes
Aug 2, 2017
Merged

Fix error-codes not updating correctly#10348
gaearon merged 2 commits intofacebook:masterfrom
thymikee:error-codes

Conversation

@thymikee
Copy link
Copy Markdown
Contributor

@thymikee thymikee commented Aug 2, 2017

Fixes #10328

If I understand correctly, calls to require() in scripts context get cached into some kind of module map, similarly like in jest-haste-map (or maybe are hoisted to the top of module behind the scenes?). At least that's what I observe.

Because the cache isn't invalidated after performing fs.writeFileSync, existingErrorMap was always the same (despite inline require), resulting in codes.json file not being updated properly.

One way to fix this is through replacing require with fs.readFileSync and that's what this PR is about.

@thymikee
Copy link
Copy Markdown
Contributor Author

thymikee commented Aug 2, 2017

cc @gaearon @trueadm who may have more context on this.

@gaearon
Copy link
Copy Markdown
Collaborator

gaearon commented Aug 2, 2017

Thanks, this is great! Can you please just leave the fix in without the codes change? We’ll update codes before the release.

@thymikee
Copy link
Copy Markdown
Contributor Author

thymikee commented Aug 2, 2017

Sure, reverted codes :)

@gaearon gaearon merged commit 73217a7 into facebook:master Aug 2, 2017
@thymikee thymikee deleted the error-codes branch August 2, 2017 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some invariant messages aren't extracted

3 participants