I want to use Drizzle ORM in my api. The api is a workspace in a monorepo build with Turborepo.
I want to generate migrations with drizzle-kit, with the following command drizzle-kit generate:pg
.
In my tsconfig I configured module and moduleResolution to ‘NodeNext’, because i transpile my ts code to JavaScript with tsc. My Drizzle schema’s are split up in multiple files, so they gets more readable.
This gives me the following problem. Because my imports are as follows: import { users } from "./users.js";
, drizzle-kit when generating my migrations does not find the file and gives the following error.
drizzle-kit: v0.20.17
drizzle-orm: v0.30.10
No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/sennau/2324BP-POCs/drizzle/api/drizzle.config.ts'
Error: Cannot find module './users.js'
Require stack:
- /home/sennau/2324BP-POCs/drizzle/api/src/data/posts.ts
- /home/sennau/2324BP-POCs/drizzle/node_modules/drizzle-kit/bin.cjs
When I add the following properties in my tsconfig and change the import to ‘.ts’, the migrations will generate but this is no option because i want to transpile my TypeScript code to JavaScript.
"allowImportingTsExtensions": true,
"emitDeclarationOnly": true
Senna Uyttersprot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.