8000 Files in Folders Ending with 'test' Like Contest Are Ignored by Metro · Issue #1515 · facebook/metro · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Files in Folders Ending with 'test' Like Contest Are Ignored by Metro #1515
Closed
@AliRezaBeigy

Description

@AliRezaBeigy

Description

While building a React Native app, I encountered an issue where Metro fails to resolve a module located in a folder ending with 'test'. Specifically, the error message indicates that the file index.tsx in the BoardContest folder (which is under Screens/Main/BoardContest) cannot be found:

Unable to resolve module ../../Screens/Main/BoardContest/index.tsx from C:\Users\ARB\AndroidStudioProjects\PokketApplication\packages\challenger-mobile\app\Navigators\AppNavigator\index.tsx: C:\Users\ARB\AndroidStudioProjects\PokketApplication\packages\challenger-mobile\app\Navigators\AppNavigator\index.tsx None of these files exist: * app\Screens\Main\BoardContest\index.tsx(.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx) * app\Screens\Main\BoardContest\index.tsx
> 8 | import BoardContestScreen from '@screen/Main/BoardContest/index.tsx';  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Through debugging the Metro Node Haste and inspecting the watcher, I traced the issue to the ignoreForCrawl function in the FileMap class. The function appears to match an ignore pattern against the file path, and it seems to ignore files when their parent folder ends with 'test'. In my case, the path C:\Users\ARB\AndroidStudioProjects\PokketApplication\packages\challenger-mobile\app\Screens\Main\BoardContest triggered this behavior, likely due to the 'test' suffix in 'BoardContest'.

Request for Help

I am not familiar with the internal workings of Metro to propose a fix, but it seems the ignore pattern might be overly aggressive when dealing with folder names ending in 'test'. Could the Metro team please investigate and adjust the ignore logic to ensure valid files in such folders are not excluded? This would help prevent similar issues for other users who might have folder names ending with 'test' for legitimate reasons.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0