I am trying to set up a monorepo as I thought sharing common code is a great idea in an ecosystem of applications as they have a lot of common types, logic and functions. My repo includes a react-native
app, a react
app, a next
app, and an express
backend application as well.I am using yarn workspaces. And I have added shared-types
as a dependency in the react-native
and react
apps. The auto imports work fine in the react
app but not in the react-native
. When I manually add the import everything works fine, but the auto imports just wouldn't work. I have done some digging but couldn't find anything useful. The things that I've looked up include this question about sharing common code and this question that uses paths
to solve it. Nothing has worked so far for me.root package.json
"workspaces": ["apps/*","backend/*","packages/*"]
The folder structure is as follows.
||__ apps| |__react-native-app| |__react-app| |__next-app|__ backend| |__express-app|__ packages |__ shared-types