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
Svelte 5: Building an app fail when creating stores using let name = $derived()
#11314
Comments
Can you provide an actual complete reproduction in the REPL please? When I try to compile that component, I'm getting a compile-time error from Svelte (not an error from Rollup) about |
Hi @Conduitry I already tried the RELP before, and it does mark it as an error. Basically this happens on local projects, maybe a linter or TS conflict? I don't know. Can you try with a demo project using TS? I have all extensions installed and updated. Yesterday I wrote to the discord server requesting that someone try to compile the example to avoid opening an issue here, but there was no one to help me. |
If you can't reproduce it in the REPL, a repository to clone that's a minimal reproduction will also work. |
Sorry for waiting, I was just creating the repositories and wanted to try using version 114, but now I'm getting the following error:
I have not changed anything in the code, I have only updated to v114 I have blocked the version at 113 to make the repositories. Repos: https://github.com/JLAcostaEC/runes-js Just clone it and run/build it. Dev mode works, build no. |
Regarding the error, see this issue: The fix is implemented and deployed to the REPL but has not been published in |
Maybe we need another issue for that... 🤔 |
Hi @Conduitry have you been able to verify this issue? Or do you need something else I can contribute? |
Describe the bug
Using
let name = $derived()
on a custom storestore.svelte.ts
file. Will break the build process getting a practically useless message to correct the problem.RollupError: The left-hand side of an assignment expression must be a variable or a property access
Read reproduction...
Reproduction
Let's create a rune store to easily get the supabase client in any app component:
(Don't get me wrong, the problem is not the $derived, i think 😵💫 )
Now let's run it (We will pretend that this store is being used in various parts of the app), so...
pnpm run dev
ornpm run dev
Running this store in dev mode everything works. But if you try to build it
pnpm run build
ornpm run build
you will get:RollupError: The left-hand side of an assignment expression must be a variable or a property access
As you can see, the error does not mention any files in the repository, the linter also did not mention anything at all. After 3 days of debug I could see that the problem was that store using $derived() instead of $state.
I think a better error message should alert you at this point.
If you change the above code to use $state, the app build without problems.
UPDATE:
Repos:
https://github.com/JLAcostaEC/runes-ts
https://github.com/JLAcostaEC/runes-js
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: