oblador/react-native-vector-icons

nx monorepo

johnf opened this issue · 1 comments

Is there a way to use the new version in monorepo projects? Currently the Copy Fonts command from react-native-vector-icons.podspec fails because it cannot find node_modules.

We're using NX as our monorepo solution and, as an example, the folder structure is like so:

  • apps
    • web
    • mobile
      • ios
      • android
      • src
  • node_modules

I got the application to build by editing PROJECT_ROOT from ${PODS_ROOT}/../.. to ${PODS_ROOT}/../../../.. but this is not feasible in the long-run because this has to be done on every dev environment and after every reinstall.

If you have any pointers or solutions for this, I'd greatly appreciate them. Thank you!

Originally posted by @seliceantitus in #1612 (comment)

@seliceantitus Are you able to provide the error output. In theory PODS_ROOT should be apps/mobile/ios/Pods would would set PROJECT_ROOT to apps/mobile which is where your package.json should be.

The script then uses resolveNodeModuleDir to workout where node_modules is from there.

Have a quick look at https://github.com/oblador/react-native-vector-icons/blob/monorepo/packages/common/src/scripts/getFonts.ts
The PROJECT_ROOT gets passed to that script as the first argument.