Skip to content

Commit

Permalink
refactor: fix compatibility with old browsers (#1000)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Nov 29, 2022
1 parent 7585663 commit 82ed663
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,9 @@ class MiniCssExtractPlugin {
])
: Template.asString([
"if (oldTag) {",
Template.indent(["oldTag.after(linkTag);"]),
Template.indent([
"oldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);",
]),
"} else {",
Template.indent(["document.head.appendChild(linkTag);"]),
"}",
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 = () => ("32c982869d9446e21cfa")
/******/ __webpack_require__.h = () => ("945622d4f51f3fe3a0d0")
/******/ })();
/******/
/******/ /* webpack/runtime/global */
Expand Down Expand Up @@ -196,7 +196,7 @@ __webpack_require__.r(__webpack_exports__);
/******/ linkTag.href = fullhref;
/******/
/******/ if (oldTag) {
/******/ oldTag.after(linkTag);
/******/ oldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);
/******/ } else {
/******/ document.head.appendChild(linkTag);
/******/ }
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 = () => ("70641d5edcf4cb37424c")
/******/ __webpack_require__.h = () => ("de494c1e7411c41d8362")
/******/ })();
/******/
/******/ /* webpack/runtime/global */
Expand Down Expand Up @@ -196,7 +196,7 @@ __webpack_require__.r(__webpack_exports__);
/******/ linkTag.href = fullhref;
/******/
/******/ if (oldTag) {
/******/ oldTag.after(linkTag);
/******/ oldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);
/******/ } else {
/******/ document.head.appendChild(linkTag);
/******/ }
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 @@ -959,7 +959,7 @@ __webpack_require__.r(__webpack_exports__);
/******/ linkTag.href = fullhref;
/******/
/******/ if (oldTag) {
/******/ oldTag.after(linkTag);
/******/ oldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);
/******/ } else {
/******/ document.head.appendChild(linkTag);
/******/ }
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 @@ -180,7 +180,7 @@
/******/ linkTag.href = fullhref;
/******/
/******/ if (oldTag) {
/******/ oldTag.after(linkTag);
/******/ oldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);
/******/ } else {
/******/ document.head.appendChild(linkTag);
/******/ }
Expand Down

0 comments on commit 82ed663

Please sign in to comment.