Skip to content

Setting up Prisma in a hoisted environment (pnpm, npm workspaces) #1910

Closed as not planned

Activity

  1. added
    type/docs
    on Jun 22, 2021
  2. changed the title [-]Setting up Prisma in a hosted environment (pnpm, npm workspaces)[/-] [+]Setting up Prisma in a hoisted environment (pnpm, npm workspaces)[/+] on Jun 22, 2021
  3. millsp commented on Jun 22, 2021

    @millsp
    Contributor

    For some more context, here's how to set up a project with pnpm https://github.com/millsp/prisma-pnpm-workspace. There are two important things:

    • Generation
      This ensures that the client is generated in the sub-project's node_modules folder. Otherwise it would get generated in the root / hoisted node_modules (for both app1 & app2) and two clients could overwrite each other.
    • Imports
      Because @prisma/client is hoisted in the root folder and reused by app1 & app2 (symlinked in their respective node_modules), we cannot resolve types or any nearby generated client. Thus it has to be imported this way.

    The main purpose of this doc is to help users that would like to generate more than one client while working in a hoisted environment (in this case, a pnpm workspace).

  4. janpio commented on Jun 22, 2021

    @janpio
    Contributor

    Meaning: If you use pnpm or similar, and just have 1 generated Client, you can do what exactly?

  5. self-assigned this
    on Aug 10, 2021
  6. molebox commented on Aug 10, 2021

    @molebox
    Contributor

    This should be added to the Development environment section

  7. added
    serverless-initiative
    on Dec 5, 2022
  8. jharrell commented on Aug 14, 2023

    @jharrell
    Contributor

    @millsp is this still the case?

  9. added
    needs-investigation
    on Aug 14, 2023
  10. millsp commented on Aug 14, 2023

    @millsp
    Contributor

    Yes this is something a lot of people who use multi-service monorepos actually run into. It's not obvious why the Prisma Clietn package gets deduplicated by some package managers, that in turn makes that you cannot output/generate multiple clients. There's one thing that I would change from my example though: the custom output into node modules, I'd just make it a custom output in the project folder and use a gitignore not to include the files.

  11. jharrell commented on Nov 21, 2024

    @jharrell
    Contributor

    👋 we're cleaning up our backlog of issues and are closing everything older than two years. If you still feel that this issue is relevant, please feel free to re-open and our team will take a look. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-investigationserverless-initiativetype/docs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions