Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metro-resolver] Respect transitive deps when using nodeModulesPaths #738

Commits on Nov 10, 2021

  1. [metro-resolver] Respect transitive deps when using nodeModulesPaths

    This fixes facebook#737 take a look at the issue for more info. I've also added a test case to hopefully catch this in the future. The order of the paths is important in this change.
    
    Without this change, the `allDirPaths` looks like this:
    ```
        [
          '/other-root/node_modules/banana-module',
          '/other-root/node_modules/banana/node_modules/banana-module',
          '/other-root/node_modules/node_modules/banana-module',
          '/other-root/node_modules/banana-module',
          '/node_modules/banana-module'
        ]
    ```
    
    See how the `banana-module` nested inside `banana` is second & not first.
    
    With this change `allDirPaths` is update to this:
    ```
        [
          '/other-root/node_modules/banana/node_modules/banana-module',
          '/other-root/node_modules/node_modules/banana-module',
          '/other-root/node_modules/banana-module',
          '/node_modules/banana-module',
          '/other-root/node_modules/banana-module'
        ]
    ```
    
    We correctly attempt to resolve the transitive `banan-module` dependency first.
    sharmilajesupaul committed Nov 10, 2021
    Copy the full SHA
    02fade6 View commit details
    Browse the repository at this point in the history
  2. Add a comment explaining a changed line

    Co-authored-by: Rae Liu <raejin@users.noreply.github.com>
    sharmilajesupaul and raejin committed Nov 10, 2021
    Copy the full SHA
    2282b7f View commit details
    Browse the repository at this point in the history