Skip to content

Commit 40c6c8f

Browse files
authored
Build: Use .min.js extension for bundled JavaScript (WordPress#23926)
Use the .min.js extension for minified, bundled sources included in the plugin. This adheres to WordPress convention.
1 parent c786a87 commit 40c6c8f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/client-assets.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function gutenberg_override_translation_file( $file, $handle ) {
120120
}
121121

122122
// Ignore scripts that are not found in the expected `build/` location.
123-
$script_path = gutenberg_dir_path() . 'build/' . substr( $handle, 3 ) . '/index.js';
123+
$script_path = gutenberg_dir_path() . 'build/' . substr( $handle, 3 ) . '/index.min.js';
124124
if ( ! file_exists( $script_path ) ) {
125125
return $file;
126126
}
@@ -247,9 +247,9 @@ function gutenberg_register_vendor_scripts( $scripts ) {
247247
* @param WP_Scripts $scripts WP_Scripts instance.
248248
*/
249249
function gutenberg_register_packages_scripts( $scripts ) {
250-
foreach ( glob( gutenberg_dir_path() . 'build/*/index.js' ) as $path ) {
250+
foreach ( glob( gutenberg_dir_path() . 'build/*/index.min.js' ) as $path ) {
251251
// Prefix `wp-` to package directory to get script handle.
252-
// For example, `…/build/a11y/index.js` becomes `wp-a11y`.
252+
// For example, `…/build/a11y/index.min.js` becomes `wp-a11y`.
253253
$handle = 'wp-' . basename( dirname( $path ) );
254254

255255
// Replace `.js` extension with `.asset.php` to find the generated dependencies file.

webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
}, {} ),
6969
output: {
7070
devtoolNamespace: 'wp',
71-
filename: './build/[basename]/index.js',
71+
filename: './build/[basename]/index.min.js',
7272
path: __dirname,
7373
library: [ 'wp', '[name]' ],
7474
libraryTarget: 'this',

0 commit comments

Comments
 (0)