Skip to content

metro.config.js is ignored if not at the root of the project #588

@asklar

Description

@asklar

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

What is the current behavior?
When running npx react-native bundle, metro will search for a metro.config.js file at the root of the project and not consider the current working directory (in fact I think the cwd is calculated to be the root of the project by a module called commander)

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.
In the @react-native-community/clipboard repo, if you try to run react-native-bundle for the example app (i.e. in the example directory), the metro.config.js file in the example directory is not loaded and instead an empty one is.

What is the expected behavior?
The actual current working directory is inspected and fall back to the root of the project.
Or please document that the metro.config.js file must be at the root of the project and not in a subfolder.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
metro 0.58
node 12.9.1
npm 6.10.2
yarn 1.22.4
Windows 10 19041

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions