May I ask for help? I'm new to turborepo. I set up an API package packages/api for tRPC. I followed this guide: tRPC Documentation for the Next.js app router. Now that I have it set up properly, I added my API package as a dependency in the Next.js web folder. I then imported tRPC from the API package into web.
In the web folder, I haven’t installed any packages required by tRPC—all tRPC packages are in the API package. My question is: can I import @tanstack/react-query in web even though I didn’t install it in web? It is installed in my API package, and my API package is listed in the dependencies in the web's package.json, or do I also need to install @tanstack/react-query in web?
Because when I hover over the import of @tanstack/react-query in web, this appears:
module "c:/Users/craft/Desktop/Dev/rhu-ii/node_modules/@tanstack/react-query/build/modern/index"
It is not coming from my API package.
This is my web package.json:
{ "name": "web", "version": "0.1.0", "type": "module", "private": true, "scripts": { "dev": "next dev --turbopack --port 3000", "build": "next build", "start": "next start", "lint": "next lint --max-warnings 0", "check-types": "tsc --noEmit", "clean": "git clean -xdf .cache .turbo node_modules" }, "dependencies": { "@remixicon/react": "^4.6.0", "@rhu-ii/ui": "*", "@rhu-ii/api": "*", "next": "^15.2.1", "react": "^19.0.0", "react-dom": "^19.0.0" }, "devDependencies": { "@rhu-ii/eslint-config": "*", "@rhu-ii/typescript-config": "*", "@rhu-ii/prettier-config": "*", "@rhu-ii/tailwind-config": "*", "@types/node": "^22.13.10", "@types/react": "19.0.10", "@types/react-dom": "19.0.4", "eslint": "^9.22.0", "typescript": "5.8.2" }, "prettier": "@rhu-ii/prettier-config"}And this is my API package's package.json:
{ "name": "@rhu-ii/api", "version": "0.0.0", "type": "module", "exports": { ".": { "types": "./dist/src/index.d.ts", "default": "./src/index.ts" }, "./client": { "types": "./dist/src/client/index.d.tsx", "default": "./src/client/index.tsx" }, "./server": { "types": "./dist/src/server/index.d.tsx", "default": "./src/server/index.tsx" } }, "scripts": { "build": "tsc", "dev": "tsc", "lint": "eslint . --max-warnings 0", "check-types": "tsc --noEmit", "clean": "git clean -xdf .cache .turbo node_modules" }, "dependencies": { "@tanstack/react-query": "^5.69.0", "@trpc/client": "^11.0.0", "@trpc/server": "^11.0.0", "@trpc/tanstack-react-query": "^11.0.0", "client-only": "^0.0.1", "server-only": "^0.0.1", "superjson": "^2.2.2", "zod": "^3.24.2" }, "devDependencies": { "@rhu-ii/eslint-config": "*", "@rhu-ii/prettier-config": "*", "@rhu-ii/typescript-config": "*", "eslint": "^9.22.0", "typescript": "5.8.2" }, "prettier": "@rhu-ii/prettier-config"}