Unable to add/update TS path alias in tsconfig.json
In a new project, it doesn't appear possible to add or change the paths defined in the tsconfig.json file.
I spun up a blank project using pnpm (pn create solid -> blank) and verified that it ran correctly. Then changed the ts config path that comes predefined from ~/* to @/*, updating the references in the project accordingly. Then running dev, the following error is returned in the console:
An unhandler error occured: Error: Cannot find module '@/components/Counter' imported from '/Projects/Personal/solid-tsconfig-check/src/routes/index.tsx'
From some additional testing, it seems like the ~/* reference is likely overriding whatever is in the typescript config file in the project. That path alias remains valid even after changing it.
Being new to Solid and Solid-Start, I'm unsure if this path is just built in to Solid and to use any other custom ones requires use of a vite plugin, or if this is a build error with Solid Start.
Thanks!
Yeah I think this might be an issue with the expectation. We currently don't support the tsconfig paths directly. We use ~/ as an alias for src/*. For adding more aliases, you would need to define in both tsconfig and vite config's resolve.alias option.
But I do understand that it'll be better if we supported the tsconfig paths directly. There is a vite plugin that does this: https://www.npmjs.com/package/vite-tsconfig-paths.. You can try this until we include it with the solidstart preset
Ok, perfect. I had a suspicion that was likely the case just by how it was behaving and seemingly unresponsive to any changes made in the tsconfig paths. The vite plugin you mentioned was something I'd considered using, but didn't want to go down that path if I was just missing something else.
Thanks for the answer!
If we implement this itll probaly be using that plugin. So you can use it directly right now to support tsconfig paths
In setting up for SolidStarts next Beta Phase built on Nitro and Vinxi we are closing all PRs/Issues that will not be merged due to the system changing. If you feel your issue was closed in mistake. Feel free to re-open it after updating/testing against 0.4.x release. Thank you for your patience. See https://github.com/solidjs/solid-start/pull/1139 for more details.