How to import Yjs, React Native?

add Yjs in package.json

added metro.config.js, config follow react native - However, this package itself specifies a `main` module field that could not be resolved - Stack Overflow
got this error:

Android Bundling failed 1531ms
While trying to resolve module yjs from file /Users/zhangjunyi/Git/SleepGrassRN/app/screens/HomeScreen.tsx, the package /Users/zhangjunyi/Git/SleepGrassRN/node_modules/yjs/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/zhangjunyi/Git/SleepGrassRN/node_modules/yjs/dist/yjs.cjs. Indeed, none of these files exist:

  • /Users/zhangjunyi/Git/SleepGrassRN/node_modules/yjs/dist/yjs.cjs(.native|.android.jsx|.native.jsx|.jsx|.android.js|.native.js|.js|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.json|.native.json|.json)
  • /Users/zhangjunyi/Git/SleepGrassRN/node_modules/yjs/dist/yjs.cjs/index(.native|.android.jsx|.native.jsx|.jsx|.android.js|.native.js|.js|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.json|.native.json|.json)

modified metro.config.js fixed the error:

module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
resolver: {
sourceExts: [‘jsx’, ‘js’, ‘ts’, ‘tsx’, ‘cjs’, ‘cms’, ‘mjs’], //add here
},
};