Create-react-native-app: Babel and Flow config should not be a part of app code

Created on 21 Mar 2017  路  1Comment  路  Source: expo/create-react-native-app

Should we consider hiding the babel and flow configs for each CRNA, and managing them as a part of react-native-scripts? This would bring CRNA in line with the behavior of CRA.

underlying tools

Most helpful comment

I think that'd be fantastic! I would love to do the same for watchman as well. I think this would require several things to happen:

  1. Pass the babel configuration to the RN packager (we need the expo preset as a layer on top of the RN preset to handle local asset requires). I haven't looked at this -- is it even possible right now? We'd also want to have some handling in place for projects where the user has specified some babel plugin that needs to run in addition to CRNA's configuration.
  2. Figure out some way for the flow config to be extendable by the user -- we'd want to use the one from react-native-scripts and merge it with any ignores or other options specified by someone who naively runs flow init. We don't want to remove the flow config entirely and leave the user to their own devices (CRA gets away with this because all of its deps are much better behaved about adding noise to the flow results).
  3. Would need to programmatically tell watchman about the empty config rather than relying on its directory-based config discovery.
  4. Make sure that all of these files get written to the project directory on eject.

>All comments

I think that'd be fantastic! I would love to do the same for watchman as well. I think this would require several things to happen:

  1. Pass the babel configuration to the RN packager (we need the expo preset as a layer on top of the RN preset to handle local asset requires). I haven't looked at this -- is it even possible right now? We'd also want to have some handling in place for projects where the user has specified some babel plugin that needs to run in addition to CRNA's configuration.
  2. Figure out some way for the flow config to be extendable by the user -- we'd want to use the one from react-native-scripts and merge it with any ignores or other options specified by someone who naively runs flow init. We don't want to remove the flow config entirely and leave the user to their own devices (CRA gets away with this because all of its deps are much better behaved about adding noise to the flow results).
  3. Would need to programmatically tell watchman about the empty config rather than relying on its directory-based config discovery.
  4. Make sure that all of these files get written to the project directory on eject.
Was this page helpful?
0 / 5 - 0 ratings