Skip to content

Custom client path still attempts to import @prisma/client #1284

@why-el

Description

@why-el

Consider this code:

// eslint-disable-next-line import/no-extraneous-dependencies
import { PrismaClient } from "@prisma-app/client";

export const createPrismockClient = async (): Promise<{
  prismaClient: PrismaClient;
  reset: () => void;
}> => {
  const { Prisma } = await import("@prisma-app/client");
  const { createPrismock } = await import("prismock");

  const PrismockClient = createPrismock(Prisma);
  const prismaClient = new PrismockClient();

  return {
    prismaClient,
    reset: () => (prismaClient as unknown as any).reset(),
  };
};

When I follow what await import("prismock"); is doing, it is doing this: import { type PrismaClient } from '@prisma/client';, which is doing this export * from '.prisma/client/default'

but export * from '.prisma/client/default' is not a thing, because the client is not generated there. For us, It is instead in @prisma-app/client, because the output in the schema.prisma is:

output = "../node_modules/@prisma-app/client"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions