react / react/metro

`assert` in `verifyRootExists` doesn't test whether root actually exists

Open
#156 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.6k
Forks
696
Avg merge
8m
Merged PRs (30d)
7

Description

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

https://github.com/facebook/metro/blob/601f718dd67c87f26574cbd2d375b3b127ea4829/packages/metro/src/Bundler/index.js#L335-L338

If root does not exist an error is thrown and the assert doesn't fire.

For libs like expo which use run react-native as a child process, they only print the error message and not the stack trace.

assert(fs.statSync(root).isDirectory(), 'Root has to be a valid directory');

What is the expected behavior?

A separate assert should check whether the root exists, and print a helpful message

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

Start in packages/metro/src/Bundler/index.js at verifyRootExists and inspect how a missing root is handled before the directory check. Reproduce the case with a nonexistent root and verify that the resulting message is helpful; done means the missing-root condition is reported separately from an invalid directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.