Nessuna descrizione

react-native.config.js 1.1KB

1234567891011121314151617181920212223242526
  1. /**
  2. * This cli config is needed for the coexistance of react-native and other
  3. * out-of-tree implementations such react-native-macos.
  4. * The following issue is tracked by
  5. * https://github.com/react-native-community/discussions-and-proposals/issues/182
  6. *
  7. * The work-around involves having a metro.config.js for each out-of-tree
  8. * platform, i.e. metro.config.js for react-native and
  9. * metro.config.macos.js for react-native-macos.
  10. * This react-native.config.js looks for a --use-react-native-macos
  11. * switch and when present pushes --config=metro.config.macos.js
  12. * and specifies reactNativePath: 'node_modules/react-native-macos'.
  13. * The metro.config.js has to blacklist 'node_modules/react-native-macos',
  14. * and conversely metro.config.macos.js has to blacklist 'node_modules/react-native'.
  15. */
  16. 'use strict';
  17. const macSwitch = '--use-react-native-macos';
  18. if (process.argv.includes(macSwitch)) {
  19. process.argv = process.argv.filter(arg => arg !== macSwitch);
  20. process.argv.push('--config=metro.config.macos.js');
  21. module.exports = {
  22. reactNativePath: 'node_modules/react-native-macos',
  23. };
  24. }