Skip to content

Provide a way to configure the mainFields for webpack #8139

Description

@CarstenLeue

The application build relies on the default webpack resolution of entry points for imported libraries, which are ["browser", "module", "main"] for a web application.

Per spec (I believe) the module entry contains the ESM5 version of the library, i.e. tree shaken but transpiled to ES5.
Some libraries, in particular those built with ng-packagr offer additional entry points, such as ESM2015 that contains a tree shaken version compiled to ES2015.

I suggest that the react scripts allow to override the desired priority order in which entry points are resolved, such that the application author can decide to consume a smaller version of a library (because it has been compiled to ES2015 instead to ES5).

In webpack this is accessible via the https://webpack.js.org/configuration/resolve/#resolvemainfields field, but this configuration is not exposed by react scripts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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