Converting MDX to CJS for React Native can be challenging due to compatibility issues. #2450
-
When I try to build cjs for node platform, Is there any way to solve it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @zfben! 👋 Taking a few steps back, setting aside the build questions. Back to your build tool question, ESM and node built in are standard, they're supported by build tools.
|
Beta Was this translation helpful? Give feedback.
Hey @zfben! 👋
Sorry you ran into some confusion.
Taking a few steps back, setting aside the build questions.
MDX compiles to HTML tags by default, React Native does not support HTML tags.
You need something like https://github.com/danieldunderfelt/rn-mdx which translates the web elements into their React native equivalent.
Back to your build tool question, ESM and node built in are standard, they're supported by build tools.
Expo and react-native/babel-preset automatically take care of this for you, make sure you have one or both enabled https://reactnative.dev/docs/next/javascript-environment#javascript-syntax-transformers
If you still see an issue consider raising with the issue with yo…