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
Errors with <svelte:element> and forwarded events #8217
Comments
Quick update - by moving our forwarded events off of the Just curious if this was an intended change or if we can expect a fix to revert to the prior behavior. Thanks! |
looks like a recent change in esbuild triggers this. please try downgrading to 0.16.8 and see if that fixes it. https://github.com/evanw/esbuild/blob/main/CHANGELOG.md#0169 |
another option to try is to add the library to optimizeDeps.exclude in vite config, which prevents it from getting prebundled with esbuild during dev |
Thanks @dominikg we'll test and respond with results. It's late here, so might not be until tomorrow. But thanks! |
Seems like a bug in Svelte where the handlers are generated twice (repl) |
the error has been fixed in esbuild 0.16.10 |
duplicated handler code has also been fixed in svelte 3.55.1 sveltejs/svelte#8142 |
Describe the bug
Hey everyone, I'm Chris from the Skeleton UI library. I wanted to report an odd issue we've seen come up with the v1.0 launch of SvelteKit.
In short, we have a couple components in our library which utilize
<svelte:element>
and forward events such ason:click|keypress|keydown|keyup
. Here's a quick example:https://github.com/skeletonlabs/skeleton/blob/53c84e3d156cf80ee5f07ac6312b617dd0d824cb/src/lib/components/AppRail/AppRailTile.svelte#L59
This works fine when we're running the local SvelteKit library project. No issues or errors reported. Functionally the components operate as expected.
Unfortunately as soon as we package and distribute the components as an NPM package, any SvelteKit project consuming the package/component suddenly start reporting errors:
Basically an error per each each forwarded event attached to the
<svelte:element>
instance.Reproduction
To confirm this issue I've created a minimal reproduction by doing the following:
package.json
script commands with the following:"package": "svelte-kit sync && svelte-package",
npm run package
cd package
thennpm pack
.You can find the generated tarball attached below:
event-forwarding-test-0.0.1.tgz
Next, I went through the process of creating another standard SvelteKit project to "consume" the package:
npm install event-forwarding-test-0.0.1.tgz --save-dev
When the component is imported the errors reported above immediately begin to show.
NOTE: I've tested this with both SvelteKit v1.0.0 and v1.0.1
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
As a temporary work around we're going to opt to move the forwarded events up and out of the
<svelte:element>
tags. However, this behavior has worked fine in the past. It is not until updating to SvelteKit v1.0.x that these errors began to appear.The text was updated successfully, but these errors were encountered: