drizzle-kit tsconfig.json paths alias

Not a drizzle issue per-se, but running into an issue trying to make drizzle-kit work again by changing target to esnext. The database schema file references some other files using an alias defined in the tsconfig.json. Any advice on getting drizzle-kit to recognize this setting?
"compilerOptions": {
"target": "esnext",
"paths": {
"@/*": ["./*"]
}
}
"compilerOptions": {
"target": "esnext",
"paths": {
"@/*": ["./*"]
}
}
schema.ts:
import { values } from "@/path/to/file";
export const table = sqliteTable("table", { value: text("value", { enum: values })})
import { values } from "@/path/to/file";
export const table = sqliteTable("table", { value: text("value", { enum: values })})
$ drizzle-kit generate:sqlite
drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

No config path provided, using default 'drizzle.config.ts'
Error: Cannot find module '@/path/to/file';
Require stack:
- /db/schema.ts
$ drizzle-kit generate:sqlite
drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

No config path provided, using default 'drizzle.config.ts'
Error: Cannot find module '@/path/to/file';
Require stack:
- /db/schema.ts
2 Replies
tacomanator
tacomanatorOP15mo ago
This was a duplicate sorry about that. I was able to fix it by registering the paths manually in the drizzle config as suggested here: https://discord.com/channels/1043890932593987624/1125147482364584007/1154633287805976606 Not sure why the
”ts-node": { "require": ["tsconfig-paths/register"] }
”ts-node": { "require": ["tsconfig-paths/register"] }
also present in tsconfig was failing but anyway that’s a separate topic.
Angelelz
Angelelz15mo ago
It just depends on what tool you're using to run your drizzle-kit command (tsc, tsx, ts-node, etc)
Want results from more Discord servers?
Add your server