Main.js called 2 times

Hi,
when I’m writting my js in script main.js is.
The browser called 2 times a diffirent main.js.
I’m using Sage version 8.5.0.
ex:

console.log(1);
main.js?ver=4.7.4:33 1
main.js:33 1

Does this happen on a fresh copy of Sage 8? What have you done to debug it?

I cloned the version 8.5
I didn’t do anythink for now, I hope someone had the same problem?

I cloned the Sage 2 months ago

commit fe9e295fc28bebefa2da47ab9400a954d9d0eb54
Author: zoom pyt@gmail.com
Date: Tue Feb 7 11:58:38 2017 -0600

first init

Hi,
find the problem it’s with ajax request, the enque_script called the script in dist/ and assets/ I tried with the path Assets\asset_path, but same problem here.

wp_enqueue_script( 'ajax-script', get_template_directory_uri() . '/dist/scripts/main.js', array('jquery') );


function my_enqueue() {
  wp_enqueue_script( 'ajax-script', get_template_directory_uri() . '/dist/scripts/main.js', array('jquery') );
  //wp_enqueue_script( 'ajax-script', Assets\asset_path('scripts/main.js'), array('jquery') );
  wp_localize_script( 'ajax-script', 'my_ajax_object',
    array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
}
add_action( 'wp_enqueue_scripts', __NAMESPACE__ .'\\my_enqueue' );

Thanks

I enqueue the script in setup.php…

function my_enqueue() {
  wp_enqueue_script('sage/js', Assets\asset_path('scripts/main.js'), ['jquery'], null, true);
  wp_localize_script( 'sage/js', 'my_ajax_object',
    array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
}
add_action( 'wp_enqueue_scripts', __NAMESPACE__ .'\\my_enqueue' );