Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mono-repo support #1

Open
sramam opened this issue Jan 23, 2023 · 0 comments
Open

mono-repo support #1

sramam opened this issue Jan 23, 2023 · 0 comments

Comments

@sramam
Copy link
Member

sramam commented Jan 23, 2023

Support multiple noun-and-verb APIs within a mono-repo

The Problem

Typical use of the prisma client is via importing @prisma/client.

Within a monorepo, this is hoisted to the mono-repo's node_modules.
@prisma/client in turn uses a hard coded ./node_modules/.prisma/client to access the generated client-js.

If the mono-repo contains multiple APIs, this results in each prisma generate overwriting the previous API.
Consequently, only the last API generated is actually available for use.

The Solution

To prevent this, we need two things:

1. Configure output in the prisma client generator:

generator client {
  provider = "prisma-client-js"
  output   = "../node_modules/.prisma/client"
}

2. Fix the import @prisma/client -> .prisma/client

import { PrismaClient } from ".prisma/client";

Summary

For this reason, Noun & Verb generated code deviates from official prisma documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant