I’ve followed the setup for creating an internal package that uses the Just-In-Time package setup for me code. I have a package for “models” (this has zod schemas and type definitions) and a package for “backend” (this package contains business logic that I share between multiple next.js apps as well as a rest API client.
Importing from these packages in any of my apps seems to work just fine, but if in my “backend” package I try to import something from my “models” package it can’t find the code and appears as if it doesn’t see any of the code from that package.
Here is the package.json for the “models” package
{
"name": "@repo/models",
"version": "1.0.0",
"exports": {
"./auth": "./src/auth.ts",
"./events": "./src/events.ts",
"./posts": "./src/posts.ts",
"./users": "./src/users.ts"
},
"scripts": {
"lint": "eslint . --max-warnings 0"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"typescript": "5.5.4"
},
"dependencies": {
"arctic": "^2.3.3",
"zod": "^3.24.1"
}
}
Here is the tsconfig for the “models” package
{
"compilerOptions": {
"moduleResolution": "node",
"module": "ESNext",
"target": "ESNext",
"esModuleInterop": true,
"skipLibCheck": true
}
}
here is the package.json for the “backend” package
{
"name": "@repo/backend",
"version": "1.0.0",
"exports": {
"./auth": "./src/auth/index.ts",
"./events": "./src/events/index.ts",
"./posts": "./src/posts/index.ts",
"./users": "./src/users/index.ts"
},
"scripts": {
"lint": "eslint . --max-warnings 0"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/models": "workspace:*",
"@repo/typescript-config": "workspace:*",
"typescript": "5.5.4"
},
"dependencies": {
"@oslojs/crypto": "^1.0.1",
"@oslojs/encoding": "^1.1.0",
"@repo/database": "workspace:*",
"arctic": "^2.3.3",
"dayjs": "^1.11.13",
"zod": "^3.24.1"
}
}
And the tsconfig for the “backend” package
{
"compilerOptions": {
"moduleResolution": "node",
"module": "ESNext",
"target": "ESNext",
"esModuleInterop": true,
"skipLibCheck": true
}
}
I am using PNPM. I can work to make a reproducible example if it would be helpful But I imagine there is something with my configuration