Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verbatimModuleSyntax require + clsx not found #21

Closed
Sheepux opened this issue Nov 1, 2024 · 5 comments
Closed

verbatimModuleSyntax require + clsx not found #21

Sheepux opened this issue Nov 1, 2024 · 5 comments

Comments

@Sheepux
Copy link

Sheepux commented Nov 1, 2024

    "vite": "^5.4.10",
    "svelte": "^5.1.3",
   "svelte-check": "^4.0.5",
   "svelte-preprocess": "^6.0.3",
   "svelte-virtuallists": "^1.3.9",

I just installed the lib via npm (not a fresh project)
And suddently my svelte build is encountering issues

 The TypeScript option verbatimModuleSyntax is now required when using Svelte files with lang="ts". Please add it to your tsconfig.json.

X [ERROR] Could not resolve "clsx"
    ../node_modules/svelte-virtuallists/dist/VirtualListNew.svelte:9:17:
      9 │ import clsx from 'clsx';

  You can mark the path "clsx" as external to exclude it from the bundle, which will remove this
  error and leave the unresolved path in the bundle.
  1. To solve clsx i had to declare it as devdependencies in my project
    I still don't know what's the actual issue

  2. The verbatim issue is an issue on svelte preprocess part
    Related to Libraries not working with svelte-preprocess v6 sveltejs/svelte-preprocess#643
    Caused by Remove dependency on svelte-preprocess sveltejs/language-tools#2391
    (this could help someone having the issue)
    I removed svelte preprocess (as I was almost not using it) and the issue disapeared

@orefalo
Copy link
Owner

orefalo commented Nov 1, 2024

tks for reporting this issue

interesting...
clsx is the lib I use to build class and styles. I wonder why npm won't bundle it.

@orefalo
Copy link
Owner

orefalo commented Nov 1, 2024

would you have a test project to reproduce the issue.

I am using the library as part of another project https://github.com/orefalo/svelte-treeviews
and it works perfectly

@ronny1982
Copy link

ronny1982 commented Nov 2, 2024

It works in your other project because clsx was added as dev dependency in package.json.
Consider adding clsx as dependency or at least as peer dependency in svelte-virtuallists.

@orefalo
Copy link
Owner

orefalo commented Nov 2, 2024

will fix...

Fixed. Thanks for reporting.

now I wonder if I should make it a peer or plain dependency.... and what are +/-

I have the feeling it should be a plain dep

@Sheepux
Copy link
Author

Sheepux commented Nov 2, 2024

fixed by v1.3.10 (closing the issue)

Thanks for the quick response :)

As for the svelte-preprocess issue there were some other solution that i didn't go through:
sveltejs/svelte-preprocess#643 (comment)

@Sheepux Sheepux closed this as completed Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants