Skip to content

Commit edc0698

Browse files
authored
fix: safer removeChild by checking parent node
1 parent 07abf0d commit edc0698

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hmr/hotModuleReplacement.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function updateCss(el, url) {
130130
newEl.isLoaded = false;
131131

132132
newEl.addEventListener("load", () => {
133-
if (newEl.isLoaded) {
133+
if (newEl.isLoaded || el.parentNode === null) {
134134
return;
135135
}
136136

@@ -139,7 +139,7 @@ function updateCss(el, url) {
139139
});
140140

141141
newEl.addEventListener("error", () => {
142-
if (newEl.isLoaded) {
142+
if (newEl.isLoaded || el.parentNode === null) {
143143
return;
144144
}
145145

0 commit comments

Comments
 (0)