pnpm workspaces, @tanstack/query-core not resolved by @tanstack/react-query
I'm trying to switch over to pnpm in my monorepo but am getting the following Typescript error when using React Query:
Module '"@tanstack/react-query"' has no exported member 'QueryKey'.
When digging into what is exported, I noticed that react-query isn't detecting the core package - where I'd think these types are exported from.
When taking a look at my node_modules folder, I can see that in the package the error is, @tanstack/react-query is directly within the node_modules directory but not the query-core dependency. The @tanstack/query-core is found within the monorepo root node_modules/.pnpm store.
It sounds to me like this is not an issue with react-query, but where the depenedencies are installed when using pnpm install.
Does anyone have an idea how this is usually solved?

1 Reply
fascinating-indigoOP•2y ago
Adding --shamefully-hoist to pnpm install seemes to do the trick