Prevent scripts from being loaded multiple times

Preventing scripts from double loading is easy using the wp_script_is() function.

Just add this snippet to wherever you’re adding an action to the wp_enqueue_scripts hook.

if(wp_script_is('myScriptName-js', 'enqueued') == false) {
    wp_enqueue_script('myScriptName', plugin_dir_url( __FILE__ ) . 'file/path/js-bundle.js');
}