Typescript path alias not working properly

I'm new to Drizzle, but I'm not able to use the path alias on schema files. Using absolute paths on the imports works without a problem, but when using any @/... path everything breaks. Right now I'm working around this problema by denying @/ imports wit ESLint but that is not a good solution long term.
No description
9 Replies
Hegar
HegarOP17mo ago
This also applies for the drizzle.config.ts
ulic
ulic14mo ago
Ever find a solution other than relative imports?
Angelelz
Angelelz14mo ago
Make sure that the rules on your bundler apply in the folder/files where you are having those issues. Also, if you are running tsc vs ts-node vs tsx to run drizzle kit commands they may or may not see your tsconfig
ulic
ulic14mo ago
I'm using vite with tsconfigPaths, but admittadly don't know much about that stuff. The issue I'm having is when trying to generate migrations and the schema uses path alias for importing consts. I guess it's specifically a drizzle-kit thing as the bundler isn't doing anything for migration generation
Angelelz
Angelelz14mo ago
Can you type the command you use to run drizzle-kit migrate? Drizzle-kit is not a standalone command, you must be using tsc, ts-node or any other Typescript runned
ulic
ulic14mo ago
pnpm drizzle-kit generate:mysql
Angelelz
Angelelz14mo ago
There go you, pnpm is not going to look at your tsconfig and resolve the paths
PizzaConsole
PizzaConsole14mo ago
@ulic.75 You can do this:
No description
No description
ulic
ulic14mo ago
@poisnfang huzzah! That is fantastic. Thank you so much.
Want results from more Discord servers?
Add your server