Description
Is your proposal related to a problem?
Flowtype introduced Enums: a new feature that extends the language https://medium.com/flow-type/introducing-flow-enums-16d4239b3180 (starting from v0.159
). In order to use the feature, certain tooling update is required: https://flow.org/en/docs/enums/enabling-enums/#toc-upgrade-tooling and a new Babel plugin needs to be enabled: https://flow.org/en/docs/enums/enabling-enums/#toc-enable-enums. Given that CRA does not allow extending Babel config, this means Flow Enums are not available for CRA users.
Describe the solution you'd like
CRA already has decent support of Flow: the user can simply create CRA project, install Flow and just use it. It is possible because Babel config includes necessary Flow-related plugins. Ideally, I'd like CRA team to consider adding babel-plugin-transform-flow-enums
to Babel config. The required runtime dependency flow-enums-runtime
can be added by the user, whenever they actually consider using Flow (and its enums).
Describe alternatives you've considered
Craco and the rest of solutions for extending CRA configs were considered. Personally, I'd like to avoid them because of possible issues with upgrading CRA versions in the future and simply because those are like Pandora's boxes.
Another alternative solution I'd consider is having a separate template (alike TypeScript) for Flow projects: (Edit: I forgot templates don't change configs)create-react-app my-project --template flowtype
. This can also help moving existing Flow-related plugins out of default settings (if it can make users life easier in any way).