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(