-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Custom-element=true issue with dispatch(); #2896
Comments
I can't reproduce this. |
I'm using the compiler in JavaScript (not the command line) so give me some
time to extract it into a working bit.
Thanks
…On Wed, May 29, 2019, 11:29 Conv ***@***.***> wrote:
I can't reproduce this. current_component is defined for me in a custom
element. Can you push a complete repro to a repo somewhere?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2896?email_source=notifications&email_token=ABIB4DEYJPZB4BWEXH7L233PXZEIRA5CNFSM4HQB35ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWOXWGQ#issuecomment-496859930>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABIB4DEBQZRGXUFNS7IF5RTPXZEIRANCNFSM4HQB35ZA>
.
|
@georges-gomes, are you using parcel-plugin-svelte? I ask because I'm using it with parcel and I'm encountering this issue which causes |
@EliSnow, not using parcel-plugin-svelte but if it calls the compiler the way I do it probably have the same result. I will report a reproduction path and hopefully the fix will serve to both cases 👍 |
It sounds like another case of multiple I think we need to look into reworking how |
@mrkishi I think you are right. Still on the same example:
It gets compiled to:
Now if you But in my case, I feed a non-rollup version of the component to the browser and redirect the imports to I guess that if I make a mega bundle of If |
If I use |
the
In my scenario all functions requiring
|
Hi Maybe my use cases is a little bit special. But, from a pure theorical Javascript perspective, it means that the js generated with Would a replacement of What do you think? Thanks |
@georges-gomes, thank you! Importing from |
@EliSnow all pleasure is mine :) |
@Conduitry what's your view on this? How do you think we should tackle this? |
If I understand the problem correctly, just changing the imports to point to This needs to be solved, but I don't think it's as simple as rewriting imports.
How are you doing the redirects, by the way? Because exports from |
@mrkishi yes you are right, Doesn't work for me because I bundle
If you bundle the components individually, it would be all good right? but probably a lot of duplicated code... |
No, bundling them individually would still throw In your case, it sounds like you just want to make |
@mrkishi Thanks I will try around these lines |
I ran into the same issue, although not with custom elements. It happened while using Workarounds:
Stacktrace:
And the corresponding lines: svelte/src/runtime/internal/lifecycle.ts Line 34 in 767ce22
svelte/src/runtime/internal/dom.ts Line 90 in caebe0d
|
I ran into this problem now. I'm trying to make and publish a function that dispatches an event using createEventDispatcher. It's intended to be used on any svelte project. But it's not bundled with svelte components so there is no "current_component". I'm getting |
Update: I was advised not to import directly from svelte on a reusable publishable store but instead declare svelte as an external. |
I think it's an issue specific to custom-element.
the following component (from tutorial)
When I click the
button
I get a "TypeError: e is undefined"It seems to come from "CreateEventDispatcher()"
current_component
is not defined for custom-elements?The text was updated successfully, but these errors were encountered: