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

Runes in non-Svelte files failing on runes not defined #239

Open
egilsster opened this issue May 1, 2024 · 1 comment
Open

Runes in non-Svelte files failing on runes not defined #239

egilsster opened this issue May 1, 2024 · 1 comment

Comments

@egilsster
Copy link

egilsster commented May 1, 2024

Trying out Svelte 5 on a fairly sized project and got blocked by this problem. I am migrating a writable store to a little API wrapping some state with the $state rune, however, if I define the object in a thing.svelte.ts file the app crashes on an error stating that $state is not defined. I suspect this has something to do with how webpack bundles these files together with different, since the same store works fine when defined within a regular Svelte file.

I am using swc to build ts and js files and the latest svelte compiler to build the svelte files. I've put up a minimal reproduction project here https://github.com/egilsster/runes-repro

It's my best guess that the problem lies within svelte-loader.

@non25
Copy link
Contributor

non25 commented May 30, 2024

Have you tried to add svelte-loader for svelte.js files also so it runs the compiler? I don't think anything else except svelte compiler understands that magic. 😁

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

2 participants