@@ -555,9 +555,9 @@ Insert styles at top of `head` tag:
555555
556556``` js
557557function insertAtTop (element ) {
558- var parent = document .querySelector (" head" );
559- // eslint-disable-next-line no-underscore-dangle
560- var lastInsertedElement = window ._lastElementInsertedByStyleLoader ;
558+ const parent = document .querySelector (" head" );
559+
560+ const lastInsertedElement = globalThis ._lastElementInsertedByStyleLoader ;
561561
562562 if (! lastInsertedElement) {
563563 parent .insertBefore (element, parent .firstChild );
@@ -567,8 +567,7 @@ function insertAtTop(element) {
567567 parent .appendChild (element);
568568 }
569569
570- // eslint-disable-next-line no-underscore-dangle
571- window ._lastElementInsertedByStyleLoader = element;
570+ globalThis ._lastElementInsertedByStyleLoader = element;
572571}
573572
574573module .exports = insertAtTop;
@@ -603,7 +602,7 @@ You can pass any parameters to `style.use(options)` and this value will be passe
603602
604603``` js
605604function insertIntoTarget (element , options ) {
606- var parent = options .target || document .head ;
605+ const parent = options .target || document .head ;
607606
608607 parent .appendChild (element);
609608}
@@ -844,6 +843,7 @@ For `development` mode (including `webpack-dev-server`), you can use `style-load
844843
845844``` js
846845const MiniCssExtractPlugin = require (" mini-css-extract-plugin" );
846+
847847const devMode = process .env .NODE_ENV !== " production" ;
848848
849849module .exports = {
@@ -860,7 +860,7 @@ module.exports = {
860860 },
861861 ],
862862 },
863- plugins: []. concat ( devMode ? [] : [new MiniCssExtractPlugin ()]),
863+ plugins: [devMode ? [] : [new MiniCssExtractPlugin ()]]. flat ( ),
864864};
865865```
866866
@@ -891,7 +891,7 @@ module.exports = {
891891** index.js**
892892
893893``` js
894- import { fooBaz , bar , "my -class " as myClass } from " ./styles.css" ;
894+ import { bar , fooBaz , "my -class " as myClass } from " ./styles.css" ;
895895
896896console .log (fooBaz, bar, myClass);
897897```
@@ -1073,8 +1073,8 @@ Insert styles at top of `head` tag.
10731073
10741074``` js
10751075function insertAtTop (element ) {
1076- var parent = document .querySelector (" head" );
1077- var lastInsertedElement = window ._lastElementInsertedByStyleLoader ;
1076+ const parent = document .querySelector (" head" );
1077+ const lastInsertedElement = globalThis ._lastElementInsertedByStyleLoader ;
10781078
10791079 if (! lastInsertedElement) {
10801080 parent .insertBefore (element, parent .firstChild );
@@ -1084,7 +1084,7 @@ function insertAtTop(element) {
10841084 parent .appendChild (element);
10851085 }
10861086
1087- window ._lastElementInsertedByStyleLoader = element;
1087+ globalThis ._lastElementInsertedByStyleLoader = element;
10881088}
10891089
10901090module .exports = insertAtTop;
@@ -1124,7 +1124,7 @@ function insertBeforeAt(element) {
11241124 const parent = document .querySelector (" head" );
11251125 const target = document .querySelector (" #id" );
11261126
1127- const lastInsertedElement = window ._lastElementInsertedByStyleLoader ;
1127+ const lastInsertedElement = globalThis ._lastElementInsertedByStyleLoader ;
11281128
11291129 if (! lastInsertedElement) {
11301130 parent .insertBefore (element, target);
@@ -1134,7 +1134,7 @@ function insertBeforeAt(element) {
11341134 parent .appendChild (element);
11351135 }
11361136
1137- window ._lastElementInsertedByStyleLoader = element;
1137+ globalThis ._lastElementInsertedByStyleLoader = element;
11381138}
11391139
11401140module .exports = insertBeforeAt;
@@ -1171,7 +1171,7 @@ You can define custom target for your styles when using the `lazyStyleTag` type.
11711171
11721172``` js
11731173function insertIntoTarget (element , options ) {
1174- var parent = options .target || document .head ;
1174+ const parent = options .target || document .head ;
11751175
11761176 parent .appendChild (element);
11771177}
0 commit comments