Combining javascript files breaks the navigation block
-
On a default WordPress install with only “Twentytwentyfive” theme and “Speed Optimizer” plugin installed and activated, an error is thrown in the console breaking the menu on mobile when “Combine JavaScript Files” is enabled.
Uncaught SyntaxError: import declarations may only appear at top level of a module
, which is related to the js module/wp-includes/js/dist/script-modules/block-library/navigation/view.min.js
Using the following code snippet mentioned in the documentation was the only way to fix that :
add_filter( 'sgo_javascript_combine_exclude_ids', 'js_sgo_javascript_combine_exclude_ids' );
function js_sgo_javascript_combine_exclude_ids( $exclude_list ) {
$exclude_list[] = '@wordpress/block-library/navigation/view-js-module';
return $exclude_list;
}But is it the only and proper way to fix this issue, or is this a bug of the plugin ?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.