react-nativemonoreponrwl-nxnx-monorepo

error: src/main.tsx: Cannot read properties of undefined (reading 'includes') Nx monorepo ios/ android app runtime error


I am creating an nx monorepo for react and react native app. Monorepo is setup successfully and building successfully on react/ios/android. On running, it is giving error.

src/main.tsx: Cannot read properties of undefined (reading 'includes') Main.tsx code:

 import { AppRegistry } from 'react-native';
import App from './app/App';

AppRegistry.registerComponent('Mobileapp', () => App);

Any suggestions are highly appreciated.

Regards, Gypsaenter image description here


Solution

  • I found the solution:

    https://github.com/nrwl/nx/issues/22665

    The answer "Comment the condition of build on .babelrc.js" works for me. Commenting below code in babelrc.js

    /* if ( process.env.NX_TASK_TARGET_TARGET === 'build' || process.env.NX_TASK_TARGET_TARGET.includes('storybook') ) { return { presets: [ [ '@nx/react/babel', { runtime: 'automatic', }, ], ], }; }*/