Closed lschierer closed 3 months ago
Hi!
Have you tried https://www.npmjs.com/package/vite-tsconfig-paths ?
That's what Remix is using within their Vite React template.
that got me close, I ended up adding --root . to several of the commands as well, see this commit if curious.
I tried https://nodejs.org/api/packages.html#subpath-imports they work well with the latest typescript and Node. They work with Vite, too, but only for direct file-to-file mapping it seems, no glob.
Gracile is now a Vite plugin, meaning the Alias thing is just the same as every framework/bare Vite users are facing.
One could source a Vite plugin for doing this. BTW. I think imports maps are better than TS paths.
Closing as it's way out of scope.
I tried to set up aliases in my tsconfig and the vite section of the gracile.config.ts files to make including the documents easier from routes at variable directory depths, and to my surprise, it blew up in my face.
I set up a minimal reproduction here. If you check that out and run the command
pnpm build
you will see that it produces the errorhowever
pnpm tsc
does not complain. I have tried this from memory of how to do so, then when that didn't work, following the directions at bothhttps://dev.to/larswaechter/path-aliases-with-typescript-in-nodejs-4353 and https://www.delasign.com/blog/react-vitejs-typescript-path-alias/ which differ slightly (I tried each way) both from each other and from what I've done in prior projects.
Either way, this ought to work and would make maintaining the route files considerably cleaner.
Thanks!!