Oung Seik
Oung Seik
TtRPC
Created by Oung Seik on 2/12/2025 in #❓-help
Can't build NextJS with TRPC vanilla client.
My mono-repo contains 3 apps and one packages as under.
- app
- agent
- server # trpc server
- client # nextjs with vanilla trpc client
- packages
- domain
- app
- agent
- server # trpc server
- client # nextjs with vanilla trpc client
- packages
- domain
I imported the trpc server from the client, the types resolve well in the text editor, but when I built I got the type error like this.
../server/src/trpc/common.ts:10:22
Type error: Cannot find module '@/collections' or its corresponding type declarations.

8 | import { Readable } from "stream";
9 |
> 10 | import { User } from "@/collections";
| ^
11 | import config from "@/config";
12 | import { PUBLIC_PATH } from "@/const";
13 |
Static worker exited with code: 1 and signal: null
../server/src/trpc/common.ts:10:22
Type error: Cannot find module '@/collections' or its corresponding type declarations.

8 | import { Readable } from "stream";
9 |
> 10 | import { User } from "@/collections";
| ^
11 | import config from "@/config";
12 | import { PUBLIC_PATH } from "@/const";
13 |
Static worker exited with code: 1 and signal: null
This is tsconfig.json of the client. Is there anything wrong?
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"jsx": "preserve",
"incremental": true,
"types": [],
"paths": {
"@/*": ["./src/*"],
}
},
"references": [{"path": "../server"}],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"jsx": "preserve",
"incremental": true,
"types": [],
"paths": {
"@/*": ["./src/*"],
}
},
"references": [{"path": "../server"}],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
4 replies