I want to use vite-node to run some database migrations which I have in $lib/server/migrate.ts
.
When I try to npx vite-node src/lib/server/migrate
, I get this error:
Error: Cannot import $lib/server/migrate.ts into client-side code
I am running this script on the server only. How do I get this to work?
I'm not sure why, but adding the .ts extension to the filename got it to run without any complaints:
npx vite-node src/lib/server/migrate.ts