Skip to content

Feature: Add extends config loading support #977

Open
@huntie

Description

@huntie

👋🏻 Good First Issue

  • An issue or task that is ideal for new open source contributors.
  • Please reach out to the issue creator before claiming an issue to discuss design.

Description

We'd like Metro's configuration to accept an extends key, similar to other tools such as ESLint and TypeScript.

This would benefit Metro users in enabling a more convenient and concise API that abstracts away the need for mergeConfig() today.

// metro.config.js
module.exports = {
  extends: ['@react-native/metro-config'],
  ...
};

Related context:

Rough design

The implementation for this feature should live in the metro-config package.

  • Update the relevant MetroConfig type constituents to add extends?: $ReadOnlyArray<string>.
  • Update loadMetroConfigFromDisk to read extends if present.
    • For each value in extends, attempt to require the config path relative to the filepath of the input config file, and apply the imported object in order via mergeConfig().
    • Throw an error if a config path cannot be resolved.
  • Add one or more test cases in packages/metro/src/integration_tests/.
  • Update documentation to illustrate usage of this feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions