diff --git a/packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js b/packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js index 7930c2b1a7..c0350f8e6f 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js +++ b/packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js @@ -81,8 +81,13 @@ export function SnippetBlock(node, context) { function can_hoist_snippet(scope, scopes, visited = new Set()) { for (const [reference] of scope.references) { const binding = scope.get(reference); + if (!binding) continue; - if (!binding || binding.scope.function_depth === 0) { + if (binding.blocker) { + return false; + } + + if (binding.scope.function_depth === 0) { continue; }