Skip to content

Commit

Permalink
fix: avoid to throw error when link doesn't have parentNode (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
VieZhong authored Mar 7, 2023
1 parent cab796f commit 6292440
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ class MiniCssExtractPlugin {
'err.code = "CSS_CHUNK_LOAD_FAILED";',
"err.type = errorType;",
"err.request = realHref;",
"linkTag.parentNode.removeChild(linkTag)",
"if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)",
"reject(err);",
]),
"}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ __webpack_require__.r(__webpack_exports__);
/******/
/******/ /* webpack/runtime/getFullHash */
/******/ (() => {
/******/ __webpack_require__.h = () => ("4568ffdcdfced785eabc")
/******/ __webpack_require__.h = () => ("b1a0d51fa05593feebfa")
/******/ })();
/******/
/******/ /* webpack/runtime/global */
Expand Down Expand Up @@ -189,7 +189,7 @@ __webpack_require__.r(__webpack_exports__);
/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
/******/ err.type = errorType;
/******/ err.request = realHref;
/******/ linkTag.parentNode.removeChild(linkTag)
/******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
/******/ reject(err);
/******/ }
/******/ }
Expand Down
4 changes: 2 additions & 2 deletions test/cases/chunkFilename-fullhash/expected/webpack-5/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ __webpack_require__.r(__webpack_exports__);
/******/
/******/ /* webpack/runtime/getFullHash */
/******/ (() => {
/******/ __webpack_require__.h = () => ("9ee2d65d5d13f2b4323d")
/******/ __webpack_require__.h = () => ("775d09b0a3e56e73fd45")
/******/ })();
/******/
/******/ /* webpack/runtime/global */
Expand Down Expand Up @@ -189,7 +189,7 @@ __webpack_require__.r(__webpack_exports__);
/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
/******/ err.type = errorType;
/******/ err.request = realHref;
/******/ linkTag.parentNode.removeChild(linkTag)
/******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
/******/ reject(err);
/******/ }
/******/ }
Expand Down
2 changes: 1 addition & 1 deletion test/cases/hmr/expected/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ __webpack_require__.r(__webpack_exports__);
/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
/******/ err.type = errorType;
/******/ err.request = realHref;
/******/ linkTag.parentNode.removeChild(linkTag)
/******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
/******/ reject(err);
/******/ }
/******/ }
Expand Down
2 changes: 1 addition & 1 deletion test/cases/insert-function/expected/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
/******/ err.type = errorType;
/******/ err.request = realHref;
/******/ linkTag.parentNode.removeChild(linkTag)
/******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
/******/ reject(err);
/******/ }
/******/ }
Expand Down
2 changes: 1 addition & 1 deletion test/cases/insert-string/expected/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
/******/ err.type = errorType;
/******/ err.request = realHref;
/******/ linkTag.parentNode.removeChild(linkTag)
/******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
/******/ reject(err);
/******/ }
/******/ }
Expand Down
2 changes: 1 addition & 1 deletion test/cases/insert-undefined/expected/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
/******/ err.type = errorType;
/******/ err.request = realHref;
/******/ linkTag.parentNode.removeChild(linkTag)
/******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
/******/ reject(err);
/******/ }
/******/ }
Expand Down

0 comments on commit 6292440

Please sign in to comment.