Skip to content

Commit

Permalink
Load .min.js files even in dev mode, generate unminified assets only …
Browse files Browse the repository at this point in the history
…in prod (#32621)
  • Loading branch information
BreadGuy007 committed Jun 14, 2021
1 parent 985554d commit 3f0c131
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function gutenberg_register_packages_scripts( $scripts ) {
// When in production, use the plugin's version as the default asset version;
// else (for development or test) default to use the current time.
$default_version = defined( 'GUTENBERG_VERSION' ) && ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? GUTENBERG_VERSION : time();
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.js' : '.min.js';
$suffix = '.min.js';

foreach ( glob( gutenberg_dir_path() . "build/*/index$suffix" ) as $path ) {
// Prefix `wp-` to package directory to get script handle.
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ module.exports = {
] )
),
new DependencyExtractionWebpackPlugin( { injectPolyfill: true } ),
new ReadableJsAssetsWebpackPlugin(),
mode === 'production' && new ReadableJsAssetsWebpackPlugin(),
].filter( Boolean ),
watchOptions: {
ignored: [ '**/node_modules', '**/packages/*/src' ],
Expand Down

0 comments on commit 3f0c131

Please sign in to comment.