diff --git a/packages/svelte/src/compiler/print/index.js b/packages/svelte/src/compiler/print/index.js index 3618a9c337..eb40fa3556 100644 --- a/packages/svelte/src/compiler/print/index.js +++ b/packages/svelte/src/compiler/print/index.js @@ -300,7 +300,13 @@ const visitors = { context.visit(node.consequent); if (node.alternate !== null) { - if (!(node.alternate.type === 'IfBlock' && node.alternate.elseif)) { + if ( + !( + node.alternate.nodes.length === 1 && + node.alternate.nodes[0].type === 'IfBlock' && + node.alternate.nodes[0].elseif + ) + ) { context.write('{:else}'); } context.visit(node.alternate);