Prisma seed incompatible with Nextjs et al. projects #5622
Labels
kind/improvement
An improvement to existing feature and code.
team/schema
Issue for team Schema.
topic: migrate
Milestone
Problem
TS projects that use an ESM value for compiler option "module" (such as any Nextjs project) will result in Prisma seed failing because the
ts-node
invocation will pass off ESM modules to Node:Suggested solution
The user should be able to customize how Prisma invokes
ts-node
.For example in Nextjs projects I have have this npm script to make for a functioning
ts-node
in the project:I suggest
prisma
look for ats-node
script in the package and if found use that instead of callingts-node
directly.Alternatives
prisma
config block in the package json like this:I don't think we could support
prisma.config.ts
because chicken-egg problem here about how to invokets-node
. And it it would be weird if users were forced to use a JS file to configure Prisma.ts-node
will never succeed with certain kinds of tsconfig settings, such as ESM module. Internally just always force CJS modules via--compiler-option
flag.Additional context
I think the solutions should not try to be 100%, include opt-out flags etc. The easiest way to opt-out is for user to
--skip-seed
and then run seed manually.The text was updated successfully, but these errors were encountered: