-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Circular dependencies throw error 500 #684
Comments
I guess this is a Vite issue. It's definitely solvable — SvelteKit used to have an SSR runtime that handled this case, but we removed it because Vite implemented something very similar — though I can't speak to how straightforward it would be to add it to Vite. Looks like there's a couple of related issues already, e.g. vitejs/vite#2258 |
Thank you. I will watch that issue |
Also running into this, was able to work around it with dynamic imports: <script lang="ts">
let Component: typeof import('$lib/component.svelte').default
import('$lib/component.svelte').then((result) => {
Component = result.default
})
</script>
<svelte:component this={Component} /> |
Fix just landed in Vite: vitejs/vite#3950 @Rich-Harris |
When I manually install vite v2.5.0-beta.2 using I'm not sure how to check if svelte kit is actually using that version of vite though... Any hints? |
I believe that Svelte kit is still technically on version 0.0.1 (meaning that they aren't using versioning). Wait until vite 2.5.0 drops and then run something like npm upgrade vite, or reinstall svelte kit entirely, is what I would try. The relevant svelte kit package.json has vite as ^2.4.3, so it should not require any action on the svelte team's part. |
Fix confirmed, thanks for checking them out! |
Describe the bug
SvelteKit throws an error when using components with circular dependencies. Repository was created with commands shown on SK homepage and almost nothing was changed. I only included components from REPL.
Logs
Console
To Reproduce
I created repo with the problem here
https://github.com/lukeeno/recursive-sveltekit
and also REPL with basically the same code, but in REPL it works
https://svelte.dev/repl/c90b530e67c94b8995bf4bb5b7f70d3b?version=3.35.0
Expected behavior
Not throwing error and recursively render components as shown in REPL
Stacktraces
Browser message
Information about your SvelteKit Installation:
npx envinfo --system --npmPackages svelte,@sveltejs/kit --binaries --browsers
Your browser Brave Version 1.20.103 Chromium: 88.0.4324.152 (Official Build) unknown (64-bit)
Your adapter Node
Severity
Really severe if you need circular dependencies, but apart from that it's okay
Additional context
Is there any workaround with async component loading?
The text was updated successfully, but these errors were encountered: