diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index e6b2c270df..ca76b11ab3 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -204,7 +204,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) {