-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Errors after context="module" to module change in Svelte 5 #13039
Comments
I can't reproduce this given the above steps. Please provide a reproduction using Stackblitz or a Github repo |
I created a repo here: https://github.com/tommyminds/svelte-5-issue It has two commits, the initial one is from a clean Something very strange is going on. When I tried today using the steps above, it did work initially. However, when I removed node_modules and did a |
Maybe you're experiencing the Svelte language server not reacting to the file changes. In VS Code, after |
This is not in VS Code. In VS Code the language server actually correctly identifies the import. This is an error that Vite throws when you run the 'pnpm run dev' command. |
I tested the repo, for me it works fine using pnpm, npm and bun. Edit: repro below also works for me, now I'm just confused. |
Got the same error here my fresh svelte install https://github.com/stephanedemotte/svelte5-bug-import-module ![]() Work if i change to |
Same as @mustafa0x with LSP |
@mustafa0x / @stephanedemotte which version of Svelte tooling are you using exactly (VS Code extension or something else, and which version)? |
This was missing in #2473 Possibly related to sveltejs/svelte#13039
https://github.com/sublimelsp/LSP-svelte v3.1.4 |
I also have this problem, changing |
Is there still someone looking into this? I have been able to reproduce this with the provided repo on many different laptops, from clean states even. Maybe it's related to the fact that all those laptops are macbooks? |
Do you have the latest version of the svelte extension? |
This is not an issue in the Vs code extension. The language server in vscode is actually working great with these changes and can autocomplete and jump to the variables without any problems. The errors happen when you run 'pnpm run dev' |
I'll try to take a look later |
I've tried exploring a bit without much success...the error is thrown by However at least for me everything works fine and after the second load the error even goes away. I'm not really sure this is a problem with |
@dominikg likely found the issue and it's upstream in vite They are using a regex to scan for dependencies...will PR later to vite to fix this |
I'm quite curious how an egregious show-stopper bug persisted this long. 😅 |
It's not really a show-stopper issue...it only matters of you are using vite and svelte and exporting something from context module and you look at the console (because the actual code works fine, it's just an error that es build throws while scanning for does) |
Thanks Paolo!
I did not realize that! When running |
Please ping me when you send a PR to Vite and I will review it there |
This seems to be working fine now with the changes to Vite and this issue can be closed |
Describe the bug
After updating from 230 to 240, which includes the
context="module"
tomodule
change, and updating my script tags to just usemodule
, I am getting errors when runningnpm run dev
. The actual code does what I expect though.Reproduction
Create a new skeleton application using
pnpm create svelte@latest
and add the following three files:src/lib/routes/+page.svelte
src/lib/ComponentA.svelte
src/lib/ComponentB.svelte
Then run
pnpm run dev
. You will see the beforementioned errors. If I switch back to usingcontext="module"
, it works again.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: