Add type="module" and nomodule attributes to WordPress scripts wp_script_add_data( 'script-handle', 'type', 'module' ); wp_script_add_data( 'script-handle', 'nomodule', true );