resolveReactNativePath.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = resolveReactNativePath;
  6. function _cliTools() {
  7. const data = require("@react-native-community/cli-tools");
  8. _cliTools = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. var _resolveNodeModuleDir = _interopRequireDefault(require("./resolveNodeModuleDir"));
  14. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. /**
  16. * Finds path to React Native inside `node_modules` or throws
  17. * an error otherwise.
  18. */
  19. function resolveReactNativePath(root) {
  20. try {
  21. return (0, _resolveNodeModuleDir.default)(root, 'react-native');
  22. } catch (_ignored) {
  23. throw new (_cliTools().CLIError)(`
  24. Unable to find React Native files looking up from ${root}. Make sure "react-native" module is installed
  25. in your project dependencies.
  26. If you are using React Native from a non-standard location, consider setting:
  27. {
  28. reactNativePath: "./path/to/react-native"
  29. }
  30. in your \`react-native.config.js\`.
  31. `);
  32. }
  33. }
  34. //# sourceMappingURL=resolveReactNativePath.js.map