QuestionFollowing the quickstart guide of prisma with the sqlite db, there is a section in docs which gives us certain options to use in our {
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2023",
"strict": true,
"esModuleInterop": true,
"ignoreDeprecations": "6.0"
}
}applying those options, can build the codebase correctly (through How to reproduce (optional)Expected behavior (optional)No response Information about Prisma Schema, Client Queries and Environment (optional)// Add your schema.prisma// Add any relevant Prisma Client queries here
|
Replies: 2 comments
|
This isn't really a Prisma issue, it's the
Three ways to fix it, pick one: 1. Run TypeScript directly with npx tsx src/index.tsNo build step, no resolution mismatch. This is what most starter projects use. 2. Switch to {
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "nodenext",
"target": "ES2023",
"strict": true,
"esModuleInterop": true
}
}With 3. Compile to CommonJS {
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "node",
"target": "ES2023",
"strict": true,
"esModuleInterop": true
}
}Easiest for short scripts since CJS resolution doesn't care about extensions. Summary: |
|
switching to using generator client {
importFileExtension = "js"
}this makes sure that when we generate our prisma client, it includes the specified file extension in it's import statements |
switching to
nodenextdidn't work either. still had the same error for my imports, as well as prisma's importsusing
tsxcan work, however there is an official solution for this. we can update ourschema.prismafile to reflect the following:this makes sure that when we generate our prisma client, it includes the specified file extension in it's import statements
https://www.prisma.io/docs/orm/reference/prisma-schema-reference#fields-for-prisma-client-provider