execute npx commands with import alias context #12148
Unanswered
kelbyfaessler
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Facing the same issue, would appreciate it if someone had an answer. A dirty workaround I found is to run utility functions in vitest files. Vitest does create the alias import contexts, and you can config it to also run on *.utility.js files. Anyone found a good solution to this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There have been several discussion questions asking how to execute custom scripts (e.g. myscript.ts) where the scripts need to be aware of sveltekits import aliases (like $lib). The answer has been to use
vite-node
to execute scripts, which works for me.What about 3rd party scripts executed via npx? For example, if I'm using drizzle the command to generate migrations is
npx drizzle-kit generate:sqlite
but if I use sveltekit's import aliases in any files that drizzle reads, it fails.
I've tried various ways to using vite-node to execute this command but so far nothing has worked. Has anyone else solved this problem?
Beta Was this translation helpful? Give feedback.
All reactions