BUG: Combine JS break some built in block JS
-
If you turn on the “Combine JS” option and are using some of the built in blocks, like the Navigation block, it will break the JS as these JS scripts need the
type="module"on thescripttag to function. It causes a JS error like the following:Uncaught SyntaxError: Cannot use import statement outside a moduleto be output into the console. Upon closer inspection the JS file causing this issue comes from the WP Cache folder and has something like the following as the first line:
// source --> /wp-includes/js/dist/script-modules/block-library/navigation/view.min.js?ver=61572d447d60c0aa5240I guess a possible fix would be to exclude any
type="module"JS includes from the combining or create a separate JS combined file for all thetype="module"JS includes and then output that file into the source HTML with thetype="module"in thescripttag for a combined modules JS file (if that is even possible).For now, simply turning off the “Combine Js” option in the WP admin works around this issue.
The topic ‘BUG: Combine JS break some built in block JS’ is closed to new replies.