First of all: I know there are several topics in this forum already touching issues like that, but I have read them all and they do not provide a solution.
My problem is the following:
wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true);
$ajax_params = array(
'ajax_url' => admin_url('admin-ajax.php'),
'ajax_nonce' => wp_create_nonce('my_nonce'),
wp_localize_script('sage/main.js', 'ajax_object', $ajax_params);
The JS variable “ajax_object” remains in the script. Do you face similar troubles (is it a bug) or am I doing something the wrong way?