Yarn Workspaces with React Native #2646
-
Hey guys, I am trying to setup a monorepo using the workspaces feature. One of the projects will be React Native based. I've setup the I get the following error: error: Error: Unable to resolve module @babel/runtime/helpers/interopRequireDefault from
yarn-workspaces/packages/components/Box.js: @babel/runtime/helpers/interopRequireDefault
could not be found within the project or in these directories:
../components/node_modules
../../node_modules
/yarn-workspaces/node_modules/@babel/runtime/helpers/interopRequireDefault Which is incorrect, the Here is what my const path = require('path');
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
extraNodeModules: new Proxy(
{},
{
get: (target, module) => {
return path.join(__dirname, `../../node_modules/${module}`);
},
},
),
},
watchFolders: [path.resolve(__dirname, '..')],
}; I've included the "dependencies": {
"@org/components": "workspace:*",
"react": "17.0.1",
"react-native": "0.64.0"
} Along with setting the "installConfig": {
"hoistingLimits": "workspaces"
} I am unsure as to what the problem might be. I created this repo which contains everything I just mentioned. Would love some feedback, thanks! 🙂 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Seems your path is wrong in the metro config: return path.join(__dirname, `../../node_modules/${module}`); Everything seems to work with: return path.join(__dirname, `./node_modules/${module}`); |
Beta Was this translation helpful? Give feedback.
Seems your path is wrong in the metro config:
Everything seems to work with: