From 05f3c203a20b6e4452969a2eb1e4b72b3d2979c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Thu, 3 Oct 2024 16:48:27 +0200 Subject: [PATCH] chore: upgrade Webpack to 5.95 and related deps (#10548) --- packages/docusaurus-bundler/package.json | 2 +- packages/docusaurus-plugin-pwa/package.json | 2 +- packages/docusaurus-plugin-pwa/src/index.ts | 23 +++++------- packages/docusaurus-types/package.json | 2 +- packages/docusaurus/package.json | 10 ++--- packages/docusaurus/src/webpack/client.ts | 2 +- packages/docusaurus/src/webpack/server.ts | 2 +- website/package.json | 2 +- yarn.lock | 41 +++++++++++++-------- 9 files changed, 45 insertions(+), 41 deletions(-) diff --git a/packages/docusaurus-bundler/package.json b/packages/docusaurus-bundler/package.json index 2c6b2235096b..643ef0fbe951 100644 --- a/packages/docusaurus-bundler/package.json +++ b/packages/docusaurus-bundler/package.json @@ -41,7 +41,7 @@ "terser-webpack-plugin": "^5.3.9", "tslib": "^2.6.0", "url-loader": "^4.1.1", - "webpack": "^5.88.1", + "webpack": "^5.95.0", "webpackbar": "^6.0.1" }, "devDependencies": { diff --git a/packages/docusaurus-plugin-pwa/package.json b/packages/docusaurus-plugin-pwa/package.json index 84c8853a8b4a..699faac7aa40 100644 --- a/packages/docusaurus-plugin-pwa/package.json +++ b/packages/docusaurus-plugin-pwa/package.json @@ -34,7 +34,7 @@ "clsx": "^2.0.0", "core-js": "^3.31.1", "tslib": "^2.6.0", - "webpack": "^5.88.1", + "webpack": "^5.95.0", "webpack-merge": "^5.9.0", "workbox-build": "^7.0.0", "workbox-precaching": "^7.0.0", diff --git a/packages/docusaurus-plugin-pwa/src/index.ts b/packages/docusaurus-plugin-pwa/src/index.ts index 85dbebc861d4..fd0aa6d56f84 100644 --- a/packages/docusaurus-plugin-pwa/src/index.ts +++ b/packages/docusaurus-plugin-pwa/src/index.ts @@ -94,20 +94,15 @@ export default function pluginPWA( configureWebpack(config, isServer, {currentBundler}) { return { plugins: [ - new currentBundler.instance.EnvironmentPlugin( - // See https://github.com/facebook/docusaurus/pull/10455#issuecomment-2317593528 - // See https://github.com/webpack/webpack/commit/adf2a6b7c6077fd806ea0e378c1450cccecc9ed0#r145989788 - // @ts-expect-error: bad Webpack type? - { - PWA_DEBUG: debug, - PWA_SERVICE_WORKER_URL: path.posix.resolve( - `${(config.output?.publicPath as string) || '/'}`, - 'sw.js', - ), - PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES: - offlineModeActivationStrategies, - }, - ), + new currentBundler.instance.EnvironmentPlugin({ + PWA_DEBUG: debug, + PWA_SERVICE_WORKER_URL: path.posix.resolve( + `${(config.output?.publicPath as string) || '/'}`, + 'sw.js', + ), + PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES: + offlineModeActivationStrategies, + }), ], }; }, diff --git a/packages/docusaurus-types/package.json b/packages/docusaurus-types/package.json index a57d2117d4cf..57663aa0ab3c 100644 --- a/packages/docusaurus-types/package.json +++ b/packages/docusaurus-types/package.json @@ -20,7 +20,7 @@ "joi": "^17.9.2", "react-helmet-async": "^1.3.0", "utility-types": "^3.10.0", - "webpack": "^5.88.1", + "webpack": "^5.95.0", "webpack-merge": "^5.9.0" }, "peerDependencies": { diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index 45236bcc2c3c..9f4fd580b59f 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -73,10 +73,10 @@ "shelljs": "^0.8.5", "tslib": "^2.6.0", "update-notifier": "^6.0.2", - "webpack": "^5.88.1", - "webpack-bundle-analyzer": "^4.9.0", - "webpack-dev-server": "^4.15.1", - "webpack-merge": "^5.9.0" + "webpack": "^5.95.0", + "webpack-bundle-analyzer": "^4.10.2", + "webpack-dev-server": "^4.15.2", + "webpack-merge": "^6.0.1" }, "devDependencies": { "@docusaurus/module-type-aliases": "3.5.2", @@ -88,7 +88,7 @@ "@types/rtl-detect": "^1.0.0", "@types/serve-handler": "^6.1.4", "@types/update-notifier": "^6.0.4", - "@types/webpack-bundle-analyzer": "^4.6.0", + "@types/webpack-bundle-analyzer": "^4.7.0", "react-test-renderer": "^18.0.0", "tmp-promise": "^3.0.3", "tree-node-cli": "^1.6.0" diff --git a/packages/docusaurus/src/webpack/client.ts b/packages/docusaurus/src/webpack/client.ts index 6ac4c5de2cb3..d09197d764b2 100644 --- a/packages/docusaurus/src/webpack/client.ts +++ b/packages/docusaurus/src/webpack/client.ts @@ -172,7 +172,7 @@ export async function createBuildClientConfig({ new ReactLoadableSSRAddon({ filename: clientManifestPath, }), - ].filter((x: T | undefined | false): x is T => Boolean(x)), + ], }, ); diff --git a/packages/docusaurus/src/webpack/server.ts b/packages/docusaurus/src/webpack/server.ts index 205d157a1323..96454dfb453d 100644 --- a/packages/docusaurus/src/webpack/server.ts +++ b/packages/docusaurus/src/webpack/server.ts @@ -51,7 +51,7 @@ export default async function createServerConfig({ name: 'Server', color: 'yellow', }), - ].filter(Boolean), + ], }); return {config, serverBundlePath}; diff --git a/website/package.json b/website/package.json index d5ce9aca8359..9de98596395e 100644 --- a/website/package.json +++ b/website/package.json @@ -65,7 +65,7 @@ "rehype-katex": "^7.0.0", "remark-math": "^6.0.0", "unist-util-visit": "^5.0.0", - "webpack": "^5.88.1", + "webpack": "^5.95.0", "workbox-routing": "^7.0.0", "workbox-strategies": "^7.0.0" }, diff --git a/yarn.lock b/yarn.lock index 185bef12ca74..5492346d4245 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3860,10 +3860,10 @@ "@types/configstore" "*" boxen "^7.0.0" -"@types/webpack-bundle-analyzer@^4.6.0": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@types/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.6.0.tgz#8863d62d2432126c2b3a9239cafa469215981c24" - integrity sha512-XeQmQCCXdZdap+A/60UKmxW5Mz31Vp9uieGlHB3T4z/o2OLVLtTI3bvTuS6A2OWd/rbAAQiGGWIEFQACu16szA== +"@types/webpack-bundle-analyzer@^4.7.0": + version "4.7.0" + resolved "https://registry.yarnpkg.com/@types/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.7.0.tgz#fe199e724ce3d38705f6f1ba4d62429b7c360541" + integrity sha512-c5i2ThslSNSG8W891BRvOd/RoCjI2zwph8maD22b1adtSns20j+0azDDMCK06DiVrzTgnwiDl5Ntmu1YRJw8Sg== dependencies: "@types/node" "*" tapable "^2.2.0" @@ -17117,7 +17117,7 @@ webidl-conversions@^7.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== -webpack-bundle-analyzer@^4.10.2, webpack-bundle-analyzer@^4.9.0: +webpack-bundle-analyzer@^4.10.2: version "4.10.2" resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.2.tgz#633af2862c213730be3dbdf40456db171b60d5bd" integrity sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw== @@ -17135,7 +17135,7 @@ webpack-bundle-analyzer@^4.10.2, webpack-bundle-analyzer@^4.9.0: sirv "^2.0.3" ws "^7.3.1" -webpack-dev-middleware@^5.3.1: +webpack-dev-middleware@^5.3.4: version "5.3.4" resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz#eb7b39281cbce10e104eb2b8bf2b63fce49a3517" integrity sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q== @@ -17146,10 +17146,10 @@ webpack-dev-middleware@^5.3.1: range-parser "^1.2.1" schema-utils "^4.0.0" -webpack-dev-server@^4.15.1: - version "4.15.1" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.15.1.tgz#8944b29c12760b3a45bdaa70799b17cb91b03df7" - integrity sha512-5hbAst3h3C3L8w6W4P96L5vaV0PxSmJhxZvWKYIdgxOQm8pNZ5dEOmmSLBVpP85ReeyRt6AS1QJNyo/oFFPeVA== +webpack-dev-server@^4.15.2: + version "4.15.2" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.15.2.tgz#9e0c70a42a012560860adb186986da1248333173" + integrity sha512-0XavAZbNJ5sDrCbkpWL8mia0o5WPOd2YGtxrEiZkBK9FjLppIUK2TgxK6qGD2P3hUXTJNNPVibrerKcx5WkR1g== dependencies: "@types/bonjour" "^3.5.9" "@types/connect-history-api-fallback" "^1.3.5" @@ -17179,7 +17179,7 @@ webpack-dev-server@^4.15.1: serve-index "^1.9.1" sockjs "^0.3.24" spdy "^4.0.2" - webpack-dev-middleware "^5.3.1" + webpack-dev-middleware "^5.3.4" ws "^8.13.0" webpack-merge@^5.9.0: @@ -17190,15 +17190,24 @@ webpack-merge@^5.9.0: clone-deep "^4.0.1" wildcard "^2.0.0" +webpack-merge@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-6.0.1.tgz#50c776868e080574725abc5869bd6e4ef0a16c6a" + integrity sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg== + dependencies: + clone-deep "^4.0.1" + flat "^5.0.2" + wildcard "^2.0.1" + webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5, webpack@^5.88.1: - version "5.94.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.94.0.tgz#77a6089c716e7ab90c1c67574a28da518a20970f" - integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg== +webpack@^5, webpack@^5.88.1, webpack@^5.95.0: + version "5.95.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.95.0.tgz#8fd8c454fa60dad186fbe36c400a55848307b4c0" + integrity sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q== dependencies: "@types/estree" "^1.0.5" "@webassemblyjs/ast" "^1.12.1" @@ -17347,7 +17356,7 @@ widest-line@^4.0.1: dependencies: string-width "^5.0.1" -wildcard@^2.0.0: +wildcard@^2.0.0, wildcard@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==