skeletonlabs / skeleton

A complete design system and component solution, built on Tailwind.
https://skeleton.dev
MIT License
5.02k stars 319 forks source link

LSP-SUGAR: typescript language server raises skeleton module found but not resolved in tailwind.config.ts #2877

Open Haiz14 opened 3 weeks ago

Haiz14 commented 3 weeks ago

Current Behavior

This error doesn't affect the working of skeleton, only the lsp complains.

Follow reproducing section, and an error like this will be raised by typescript server language server.

 │     Cannot find module '@skeletonlabs/skeleton/plugin' or its corresponding type declarations. typescript (2307) [3, 26]
 │        There are types at '/data/data/com.termux/files/home/teste-skeleton-next/node_modules/@skeletonlabs/skeleton/dist/plugin/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. 

Typescript language server version ❯ typescript-language-server --version 4.3.3

Expected Behavior

LSP shouldn't raise this error.

Steps To Reproduce

  1. Standard installation of skeleton-next sveltekit via https://next.skeleton.dev/docs/get-started/installation/sveltekit
  2. Final tailwind.config.ts should be something like
    
    import type { Config } from 'tailwindcss';
    import { join } from 'path';
    import { skeleton } from '@skeletonlabs/skeleton/plugin';
    import * as themes from '@skeletonlabs/skeleton/themes';

export default { content: [ './src/*/.{html,js,svelte,ts}', join(require.resolve('@skeletonlabs/skeleton-svelte'), '../*/.{html,js,svelte,ts}') ],

theme: {
    extend: {}
},

plugins: [
    skeleton({
        themes: [
            themes.rose,
            themes.cerberus,
        ],
    })
]

} as Config;


3. Check your typescript lsp errors. It should show the expected error.

### Link to Reproduction / Stackblitz

_No response_

### More Information

`tsconfig.json` 's `modupeResolution` is `bundler`
Haiz14 commented 3 weeks ago

not reproducible in vscode, should i close it? It only occurs in my neovim lsp.

endigo9740 commented 3 weeks ago

@Haiz14 we'll leave it for now for documentation sake.

Xenon27 commented 1 week ago

I have a similar thing in VS-Code

Bildschirmfoto 2024-10-28 um 17 32 58
endigo9740 commented 1 week ago

@Haiz14 @Xenon27 I was able to replicate a similar issue last week when testing Skeleton for a Next.js project with Turbopack enabled. Can the two of you confirm which framework you're using.

  1. SvelteKit | Next.js | other
  2. If Next.js are you using Turbopack: Yes/No

EDIT Haiz I see you linked to the SvelteKit docs, so I'm going to assume this is what you were using. But I'll let you confirm.

Xenon27 commented 1 week ago

I am using SvelteKit

Haiz14 commented 1 week ago

Sveltekit

slythom commented 1 day ago

Same error: Cannot find module '@skeletonlabs/skeleton/plugin' or its corresponding type declarations.

With SvelteKit. Skeleton v3 beta.

endigo9740 commented 1 day ago

Just FYI folks, we've made some headway on this. We have a PR pending. We'll test and release a patch asap:

endigo9740 commented 8 hours ago

@Haiz14 @Xenon27 @slythom we've just pushed out an update to the core package. That should be:

@skeletonlabs/skeleton 3.0.0-next.7  

If you guys would please update and verify this resolves things on your end.

If you're using VS Code, make sure to restart the local environment. You can do this with shift + control + P on Windows. Either of the first two options should work.

Screenshot 2024-11-07 at 1 40 01 PM

If all else fails just restart VS Code.

slythom commented 7 hours ago

Everything is fine now! Well done, thanks!! And I didn't need to restart the local environment.

endigo9740 commented 7 hours ago

Glad to hear! We'll await confirmation from a couple other folks before we close out the issue.