diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index eb3389e3f86..de2453ba2d5 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -203,7 +203,9 @@ export function insert_hydration(target: NodeEx, node: NodeEx, anchor?: NodeEx) } export function detach(node: Node) { - node.parentNode.removeChild(node); + if (node.parentNode) { + node.parentNode.removeChild(node); + } } export function destroy_each(iterations, detaching) {