Skip to content

Conversation

@TomCorvus
Copy link
Contributor

Fix #46

Copy link
Owner

@douglasjunior douglasjunior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I'm curious why this is needed, I don't remember to see this in the RN documentation.

@douglasjunior douglasjunior merged commit d4b3c33 into douglasjunior:main Jun 30, 2025
@TomCorvus
Copy link
Contributor Author

It seems necessary to define it to differentiate the entry point according to the environment and recommended to be compatible with new arch.
nodejs/node#45367

We can also define exports key since RN 0.72 like this:

  "main": "dist",
  "react-native": "src",
  "exports": {
    ".": {
      "default": "./dist/index.ts",
      "react-native": "./src/index.js"
    },
    "./package.json": "./package.json"
  },

https://metrobundler.dev/docs/package-exports#migration-guide-for-package-maintainers
https://reactnative.dev/blog/2023/06/21/package-exports-support#the-new-react-native-condition

To respect nodeJS >= 12.7.0 convention
https://nodejs.org/api/packages.html#package-entry-points

And supported by Metro since 0.82 version (RN 0.79):
https://reactnative.dev/blog/2025/04/08/react-native-0.79#metro-faster-startup-and-package-exports-support

And keep react-native key for previous versions.

@douglasjunior
Copy link
Owner

Nice, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could not find component config for native component

2 participants