-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
bind:this does not work in code outside of the app itself #2937
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
Comments
This problem is related to the discussion at #2896 (since they closed that one, we can keep track of it here): Svelte components can't properly consume other pre-compiled Svelte components because you end up with multiple, distinct I believe we need to figure out an internal api for Svelte to connect third-party components' internals at instantiation. In the meanwhile, if these components can share the same build process, consider using the |
How do I use |
Just point it to your package's main source file (be that a |
Including |
You also need to make |
It seems to be the same issue that I have on #2620, is it? |
Hi All, As suggested by @mrkishi, my app & components could potentially share the same build process. So, in my component's
After this when I build my app I run into following error - Could any one help me with steps\pointers to fix this. Also looking at @Conduitry's reply here , does it mean that the issue will be solved only if we use |
UpdateMy team has used webpack's resolve.alias field to solve the problem. Summarizing my environment(updated) details and the steps that helped us: Environment
Steps
From what I understood, rollup has a rollup-plugin-node-resolve plugin which has a dedupe config and achieves something similar. I am also open to any suggestions\feedback OR a more appropriate way of handling this issue. |
@prashantsail Thank you very much for that! The webpack templates now have |
bind:this
only seems to work when the code is located in the same module as the app code.This is problematic for library code such as a UI component library.
To demonstrate the problem, I've created a minimal Button component inside a (mini) monorepo.
When using the exact same Button code, the binding only works for the local Svelte module.
These do not work (as in: they do render but without the binding):
This does work:
I've created a small demo project that shows the behavior:
https://github.com/ArthurClemens/test-bind-this (instructions provided).
The text was updated successfully, but these errors were encountered: