Skip to content
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

Svelte 5 migrate function throws if there's no semicolon at the end of a reactive statement #11689

Closed
tomtiao opened this issue May 20, 2024 · 0 comments · Fixed by #11704
Closed

Comments

@tomtiao
Copy link

tomtiao commented May 20, 2024

Describe the bug

The migrate function throws an error with the message Error: Cannot overwrite a zero-length range – use appendLeft or prependRight instead. It works fine if there's a semicolon at the end though.

Stack when throws:

Error: Cannot overwrite a zero-length range – use appendLeft or prependRight instead
    at NA.update (compiler/index.js@5.0.0-next.136:1:633353)
    at LabeledStatement (compiler/index.js@5.0.0-next.136:1:678165)
    at next (compiler/index.js@5.0.0-next.136:1:900)
    at _ (compiler/index.js@5.0.0-next.136:1:675892)
    at e (compiler/index.js@5.0.0-next.136:1:871)
    at eval (compiler/index.js@5.0.0-next.136:1:591)
    at Array.forEach (<anonymous>)
    at next (compiler/index.js@5.0.0-next.136:1:540)
    at i (compiler/index.js@5.0.0-next.136:1:309)
    at next (compiler/index.js@5.0.0-next.136:1:900)

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACk2OzWrDMAzHX0WIHtY10K5HzwmUPUa9w-ooYObIJpYHw_jdh5PS9aif_l8FJ-cpoboW5K-ZUOElRuxQfmM70g95IewwhbzYRnSyi4syGDbiScCGzAI9nAw3NGW24gKDY7vQTCwveyjtY2STHnp4e2-gbo6dgjHkm6fx4x616V7hbFgf_-tY37JIYAisrHf2uy-PkrruWWlSUNaE2uybZTCs4_DIVVCeK6s-xgE7nMPoJkcjKlky1c_6B3LUWlgeAQAA

Logs

index-ZdIW0gts.js:80 Console was cleared
index-ZdIW0gts.js:80 running Svelte compiler version 5.0.0-next.136
index.js@5.0.0-next.136:1  Error while migrating Svelte code
e.migrate @ index.js@5.0.0-next.136:1
d @ index-ijMT1Sp-.js:5
(anonymous) @ index-ijMT1Sp-.js:2

System Info

REPL

Severity

annoyance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant