From b024d2dfacb95eb9d66cc03f314e4428df7a583e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Tue, 3 Dec 2024 04:26:57 +0100 Subject: [PATCH] Apply suggestions from code review --- packages/dependency-extraction-webpack-plugin/lib/index.js | 2 ++ packages/scripts/config/webpack.config.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/dependency-extraction-webpack-plugin/lib/index.js b/packages/dependency-extraction-webpack-plugin/lib/index.js index 15307716ce44c9..0fdd78c9e1541e 100644 --- a/packages/dependency-extraction-webpack-plugin/lib/index.js +++ b/packages/dependency-extraction-webpack-plugin/lib/index.js @@ -388,6 +388,8 @@ class DependencyExtractionWebpackPlugin { } if ( compilation.options?.optimization?.runtimeChunk !== false ) { + + // Sets the script handle for the shared runtime file so WordPress registers it only once when using the asset file. assetData.handle = compilation.name + '-' + diff --git a/packages/scripts/config/webpack.config.js b/packages/scripts/config/webpack.config.js index 9dfb64e9245fba..bff448f2b6cdd0 100644 --- a/packages/scripts/config/webpack.config.js +++ b/packages/scripts/config/webpack.config.js @@ -342,6 +342,8 @@ const scriptConfig = { } ); if ( hasReactFastRefresh ) { + + // Prepends the file reference to the shared runtime chunk to every script type defined for the block. const runtimePath = relative( dirname( absoluteFrom ), fromProjectRoot(