I'm using turborepo (with pnpm workspaces) and having this architecture :
- src/||- apps |_ front (svelte kit)|- packages |_ core (ts library with my business logic, including Prisma definition and requests) |_ ui (svelte UI components)
My "core" package contains the prisma managment and my business logic : ts classes with static methods dealing the CRUD operations with prisma requests, to be used by other package (mainly the "front" one).Everything is working well in dev mode.
But when building it :
".prisma/client/index" is imported by ".prisma/client/index?commonjs-external", but could not be resolved – treating it as an external dependency. ^TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ".prisma/client/index" is not a valid package name imported from P:\01_DEV\02_Web\private\test_turbo_prisma\apps\front\.svelte-kit\output\server\entries\pages\_page.server.ts.js
To reproduce it, i've just created a turbo project from scratch.
"front" is just a simple skeleton sveltekit app added in apps with "create vite@latest".Of course, I've added "core":"workspace:*" in dependencies.
I've just add a +page.server.ts in routers root for loading articles from my db through "core" package :
import { ArticleManager } from "core";export async function load() { try { const docs = await ArticleManager.getAll(); return docs; } catch(err:any) { return false; }}
and add the neccessary code in +page.svelte to display the received data.
So my "front" package doesn't use directly prisma.
Ang again, everything's working well in dev mode.