Description
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.