diff --git a/node_modules/svelte/internal/index.js b/node_modules/svelte/internal/index.js
index 1cce90d..6220522 100644
--- a/node_modules/svelte/internal/index.js
+++ b/node_modules/svelte/internal/index.js
@@ -374,7 +374,7 @@ function insert_hydration(target, node, anchor) {
     }
 }
 function detach(node) {
-    node.parentNode.removeChild(node);
+    if (node.parentNode) node.parentNode.removeChild(node);
 }
 function destroy_each(iterations, detaching) {
     for (let i = 0; i < iterations.length; i += 1) {
diff --git a/node_modules/svelte/internal/index.mjs b/node_modules/svelte/internal/index.mjs
index 6650e85..b746187 100644
--- a/node_modules/svelte/internal/index.mjs
+++ b/node_modules/svelte/internal/index.mjs
@@ -370,7 +370,7 @@ function insert_hydration(target, node, anchor) {
     }
 }
 function detach(node) {
-    node.parentNode.removeChild(node);
+    if (node.parentNode) node.parentNode.removeChild(node);
 }
 function destroy_each(iterations, detaching) {
     for (let i = 0; i < iterations.length; i += 1) {
