I have set up a react native monorepo using Yarn Workspaces. The goal would be to write one App as core, and the versions for different platforms would be siblings of core in the monorepo and would import core's App and just inject different dependencies based on what the platforms support.
Structure
monorepo
-- core
-- A (imports core)
-- B (imports core)
On A I am trying to build for Web using react-native-web, Core is compiled using TSC and imported as a module in A. The problem is that Core uses React Query as a dependency, but it is nohoisted and installed separately in A. In the browser, the interpreter reaches some code from Core that accesses a constructor from React Query and throws an error.
Debugging I see that the result of require("@tanstack/react-query") results in this react_query_1: "/static/media/index.0fc0c3105e6c3255a746.cjs"
and new react_query_1.QueryClient() throws as expected an error that QueryClient is not a constructor.
What could be wrong here?