Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 316f3d4

Browse files
nerradmikejolley
authored andcommitted
Ensure frontend script assets are registered with the right suffix for the environment. (#1157)
* ensure registered frontend scripts use correct suffix for environment * update how suffix is added to frontend builds!
1 parent 6762856 commit 316f3d4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

bin/webpack-helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ const getFrontConfig = ( options = {} ) => {
279279
entry: getEntryConfig( false, options.exclude || [] ),
280280
output: {
281281
path: path.resolve( __dirname, '../build/' ),
282-
filename: `[name]${ fileSuffix }-frontend.js`,
282+
filename: `[name]-frontend${ fileSuffix }.js`,
283283
// This fixes an issue with multiple webpack projects using chunking
284284
// overwriting each other's chunk loader function.
285285
// See https://webpack.js.org/configuration/output/#outputjsonpfunction

src/Assets.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ protected static function register_script( $handle, $src, $deps = [], $has_i18n
165165
* @param string $name Name of the script used to identify the file inside build folder.
166166
*/
167167
public static function register_block_script( $name ) {
168-
$filename = 'build/' . $name . '.js';
169-
self::register_script( 'wc-' . $name, plugins_url( $filename, __DIR__ ) );
168+
self::register_script( 'wc-' . $name, plugins_url( self::get_block_asset_build_path( $name ), __DIR__ ) );
170169
wp_enqueue_script( 'wc-' . $name );
171170
}
172171

0 commit comments

Comments
 (0)