From a85d63823b0a1eff815f470e7d8e13fef00e3e8f Mon Sep 17 00:00:00 2001 From: Zack Jackson Date: Sat, 11 Mar 2023 13:03:58 -0800 Subject: [PATCH 1/4] fix: package.json & yarn.lock to reduce vulnerabilities (#338) --- package.json | 2 +- yarn.lock | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b3356341..66a9e787 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "webpack": "^4.4.0 || ^5.0.0" }, "dependencies": { - "loader-utils": "^2.0.0", + "loader-utils": "^2.0.4", "normalize-url": "1.9.1", "schema-utils": "^1.0.0", "webpack-sources": "^1.1.0" diff --git a/yarn.lock b/yarn.lock index df63cde4..09023d72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6908,6 +6908,15 @@ loader-utils@^2.0.0: emojis-list "^3.0.0" json5 "^2.1.2" +loader-utils@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c" + integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw== + dependencies: + big.js "^5.2.2" + emojis-list "^3.0.0" + json5 "^2.1.2" + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" From a22d538107d23f2da71e239391d400a0ae9d45e0 Mon Sep 17 00:00:00 2001 From: Zack Jackson Date: Sat, 11 Mar 2023 13:04:06 -0800 Subject: [PATCH 2/4] fix: package.json & yarn.lock to reduce vulnerabilities (#337) From a2ea7590997a990b15032739edc20cbb8b14a32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kurt=20Inge=20Sm=C3=A5dal?= Date: Fri, 15 Sep 2023 04:19:41 +0200 Subject: [PATCH 3/4] Do not add style as body link if it already exists (#307) --- src/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 62a515da..467b1155 100644 --- a/src/index.js +++ b/src/index.js @@ -330,6 +330,7 @@ class ExtractCssChunksPlugin { '', `// ${pluginName} CSS loading`, `var supportsPreload = ${supportsPreload}`, + `var linkExists = false`, `var cssChunks = ${JSON.stringify(chunkMap)};`, 'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);', 'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {', @@ -343,7 +344,13 @@ class ExtractCssChunksPlugin { Template.indent([ 'var tag = existingLinkTags[i];', 'var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href");', - 'if((tag.rel === "stylesheet" || tag.rel === "preload") && (dataHref === href || dataHref === fullhref)) return resolve();', ]), + 'if((tag.rel === "stylesheet" || tag.rel === "preload") && (dataHref === href || dataHref === fullhref)) {', + Template.indent([ + 'linkExists = true', + 'return resolve();', + ]), + '}', + ]), '}', 'var existingStyleTags = document.getElementsByTagName("style");', 'for(var i = 0; i < existingStyleTags.length; i++) {', @@ -387,7 +394,7 @@ class ExtractCssChunksPlugin { '}).then(function() {', Template.indent([ 'installedCssChunks[chunkId] = 0;', - 'if(supportsPreload) {', + 'if(!linkExists && supportsPreload) {', Template.indent([ 'var execLinkTag = document.createElement("link");', `execLinkTag.href = ${mainTemplate.requireFn}.p + ${linkHrefPath};`, From 18837c2ddc4175313cfd812698e7fae4ae4a7acc Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Thu, 14 Sep 2023 19:26:02 -0700 Subject: [PATCH 4/4] publish --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66a9e787..2a56abd9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "extract-css-chunks-webpack-plugin", - "version": "4.9.0", + "version": "4.10.0", "description": "Extract CSS from chunks into stylesheets + HMR. Supports Webpack 4 + SSR", "license": "MIT", "author": "James Gillmore ",