You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while dispatching a custom event, following error gets thrown.
index-e29e855b.js:304 Uncaught TypeError: Cannot destructure property 'cancelable' of 'undefined' as it is undefined.
at index-e29e855b.js:304:27
at HTMLButtonElement.decrease (index.svelte-50532f6b.js:84:5)
This happens only when I run svelte-kit build && svelte-kit preview. Its little baffling because svelte source code correctly defines default parameter to the third parameter. However, on build, the default value gets stripped out. I tried with non-minified build also and see the same result.
Workaround: Currently a simple workaround is to pass an empty third parameter to dispatch method.
On the console, cancel the svelte-kit dev process and then start npm run build && npm run preview command.
When - or + button is clicked, a custom dispatch event is called. ideally it should print the show the current count in the parent component. However, on my browser, above error is thrown.
Logs
index-e29e855b.js:304 Uncaught TypeError: Cannot destructure property 'cancelable' of 'undefined' as it is undefined.
at index-e29e855b.js:304:27
at HTMLButtonElement.decrease (index.svelte-50532f6b.js:84:5)
Weird. I wonder whether we're running into a Rollup/Terser/esbuild optimization bug? The unoptimized code in createEventDispatcher does look like it would avoid this, as you noted.
Having the same problem. Spent a couple of hours trying to understand what's going on but couldn't until I saw this issue. It's actually making some libraries not work in my case.
Edit: Tried with SvelteKit version 1.0.0-next.338 and error is gone.
Describe the bug
while dispatching a custom event, following error gets thrown.
This happens only when I run
svelte-kit build && svelte-kit preview
. Its little baffling because svelte source code correctly defines default parameter to the third parameter. However, on build, the default value gets stripped out. I tried with non-minified build also and see the same result.Workaround: Currently a simple workaround is to pass an empty third parameter to
dispatch
method.Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-9twecw?file=src/lib/Counter.svelte
On the console, cancel the
svelte-kit dev
process and then startnpm run build && npm run preview
command.When
-
or+
button is clicked, a custom dispatch event is called. ideally it should print the show thecurrent count
in the parent component. However, on my browser, above error is thrown.Logs
System Info
Severity
annoyance
Additional Information
I thought of raising it in this repo, since the issue is happening during the
svelte-kit build
.The text was updated successfully, but these errors were encountered: