Description
As started in #5103, would like to propose a bit more of module processing than v2 is intended to have.
My first impression on module build was "finally, the same build for all the code!", but as I see it is not actually true, @gaearon explained that modules should be in a valid JavaScript format already.
Our use case: several projects depend on "core" package which was decided to use as a node module via git (not a git submodule for couple of reasons on convenience). Now have to build "core" project files with a separate script and Babel setup. It has some components, helpers, etc. And we want to have ability to use flat imports mainly. Components use JSX, which is not supported by module build as it figured out.
Proposal: Additional JS pre-processing on module build
Let's have couple options I see for the consideration:
- Ability to "turn on" same preprocessing for modules as current project already has.
- Ability to add something to Babel "plugins" section (like "transform-react-jsx").
- Ability to use those modules as is in application tests (see "react-scripts test" fails for valid JS files from modules which are successfully built #5164 with example repos).
Those options would probably have a better use with ability to specify this for the "list of modules/mask", or "per module".