You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using SvelteKit and trying to use Vite's CSS Module feature, and it works pretty well; the only thing that's lacking that would make it ideal is type-safety.
For that, I tried to use "typescript-plugin-css-modules", which requires you to add a compilerOptions.plugins to your tsconfig.json file. Here's what mine looks like (it's the default tsconfig.json file in SvelteKit templates + a plugins array pointing to "typescript-plugin-css-modules"):
Now, this seems to work perfectly in .ts files, and I get the right typing:
In .svelte files, however, it doesn't — it seems to be ignoring tsconfig.json's plugins, and just falling back to the types declared by Vite.
Another possible explanation is that the Svelte language server is using VS Code's TypeScript version, as opposed to the workspace's TypeScript version — which is what "typescript-plugin-css-modules" needs (see this). The extension could provide an option to change that, like Volar does.
But I'm not familiar with the inner workings of the codebase to be able to tell. So, I'd appreciate some help. Thanks.
System Info
OS: Ubuntu 22.04
IDE: VSCode
Which package is the issue about?
svelte-language-server
The text was updated successfully, but these errors were encountered:
I am closing as a duplicate of #905. The typescript plugin feature is only available in the tsserver but we're using a lower-level languageService API. And the plugin creation option also requires some tsserver specific APIs so we can't load the plugin by ourselves either.
We could maybe create a 3rd party interface for loading the plugin but the existing plugins still need to adopt for that to work.
Describe the bug
I'm using SvelteKit and trying to use Vite's CSS Module feature, and it works pretty well; the only thing that's lacking that would make it ideal is type-safety.
For that, I tried to use "typescript-plugin-css-modules", which requires you to add a
compilerOptions.plugins
to yourtsconfig.json
file. Here's what mine looks like (it's the defaulttsconfig.json
file in SvelteKit templates + aplugins
array pointing to "typescript-plugin-css-modules"):Now, this seems to work perfectly in
.ts
files, and I get the right typing:In
.svelte
files, however, it doesn't — it seems to be ignoringtsconfig.json
'splugins
, and just falling back to the types declared by Vite.Another possible explanation is that the Svelte language server is using VS Code's TypeScript version, as opposed to the workspace's TypeScript version — which is what "typescript-plugin-css-modules" needs (see this). The extension could provide an option to change that, like Volar does.
But I'm not familiar with the inner workings of the codebase to be able to tell. So, I'd appreciate some help. Thanks.
System Info
Which package is the issue about?
svelte-language-server
The text was updated successfully, but these errors were encountered: