Issues not fixes! Script Error for frontend.min.js type=”module”
-
Hi, i back with issues
Front End Script Error for frontend.min.js type=”module”
https://ww.wp.xz.cn/support/topic/front-end-script-error-for-frontend-min-js-typemodule/
https://ww.wp.xz.cn/support/topic/uncaught-syntaxerror-15/
is not resolved issues in latest version. Your function remains unchanged without the condition I offered you.
/** * Update script tag. * The vue code needs type=module. */ public function script_loader_tag( $tag, $handle, $src ) { if ( ! in_array( $handle, $this->own_handles ) ) { return $tag; } // Change the script tag by adding type="module" and return it. $html = str_replace( '></script>', ' type="module"></script>', $tag ); $domain = monsterinsights_is_pro_version() ? 'ga-premium' : 'ga-premium'; $html = monsterinsights_get_printable_translations( $domain ) . $html; return $html; }My fix add line
// Check if the 'monsterinsights-vue-frontend' script is the target if ( 'monsterinsights-vue-frontend' === $handle ) { // Remove any existing type attribute $tag = str_replace( 'text/javascript', 'module', $tag ); }FULL code
/** * Update script tag. * The vue code needs type=module. */ public function script_loader_tag( $tag, $handle, $src ) { if ( ! in_array( $handle, $this->own_handles ) ) { return $tag; } // Check if the 'monsterinsights-vue-frontend' script is the target if ( 'monsterinsights-vue-frontend' === $handle ) { // Remove any existing type attribute $tag = str_replace( 'text/javascript', 'module', $tag ); } // Change the script tag by adding type="module" and return it. $html = str_replace( '></script>', ' type="module"></script>', $tag ); $domain = monsterinsights_is_pro_version() ? 'ga-premium' : 'ga-premium'; $html = monsterinsights_get_printable_translations( $domain ) . $html; return $html; }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Issues not fixes! Script Error for frontend.min.js type=”module”’ is closed to new replies.