-
-
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
if/else regression in 3.9.2 #3505
Labels
Comments
This appeared in 3.9.1, and apparently #3478 in 3.9.2 was an incomplete fix. |
This seems to be caused by an empty dependencies array in IfBlocks.ts file, generated code is if ((show_if == null) || ) show_if = !!("Eva".startsWith('E') == true) Updating line 246 to check the array length should fix this issue : ${snippet && `if ((${condition} == null) || ${dependencies.length > 0 ? dependencies.map(n => `changed.${n}`).join(' || ') : false}) ${condition} = !!(${snippet})`} generating code : if ((show_if == null) || false) show_if = !!("Eva".startsWith('E') == true) |
Rich-Harris
added a commit
that referenced
this issue
Sep 6, 2019
Rich-Harris
added a commit
that referenced
this issue
Sep 8, 2019
fix code generation for if-else with static conditions
🙌 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
{#if "Eva".startsWith('E')}
eee
{:else}
rrr
{/if}
will throw an error
To Reproduce
https://svelte.dev/repl/60ba4405814042e4925edc98e3bcc797?version=3.9.2
Expected behavior
no error
Stacktraces
Rollup: Unexpected token (Note that you need
Severity
breaking change
The text was updated successfully, but these errors were encountered: