-
-
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
Bug with bindings across compilation units #6530
Comments
I could hack it to work by changing: var binding_callbacks = []; from here to be globalThis.binding_callbacks = globalThis.binding_callbacks || []; That's obviously not the way to go, but it seems to me, that it's not just a bug, but that Svelte does not support combining multiple compilation outputs together. Is this out of scope for Svelte? I assume that in order for this to work, |
Could I get a feedback for this issue. It would really help me plan for the future. |
So, the problem here turned out to be bundling multiple copies of svelte/internal, as each copy retains its own state. We were able to work around the issue by exporting the copy bundled with the base code as a global. We exclude svelte from the add-on bundle, and map the call to require("svelte/internal") at runtime to the base code's copy of svelte/internal. |
I'm going to close this. Bundling multiple copies of the internals causes a number of issues. |
Describe the bug
Following scenario: we provide a base app (
App.svelte
), and some components for users to use (Component.svelte
).The users are supposed to provide their own add-on components (
AddOn.svelte
), which can use our components, and then add them to the base app through an interfaceapp.addComponent(myaddon)
. The add-ons are then inserted using<svelte:element bind:this={myaddon} />
When using those provided components inside the add-on, we can set properties, but we cannot bind to them.
Reproduction
https://github.com/hgiesel/svelte-bug-example
Logs
No response
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: