“Intercept” enqueing of 3rd party’s JS file

I was able to deal with this by letting the minified JS load normally, and then de-registering and de-queuing it, and finally enqueuing the non-minified one… Although personally I’d consider this an indirect method, it’s probably the only way to do it, since there is obviously no way to hook into the process of originally enqueuing a script…

So my solution was inspired by a comment to my question by @TomJNowell and by this answer to another question also!

So the code I used was this:

add_action('wp_enqueue_scripts', 'wvg_load_non_minified_js', 10, 0);
function wvg_load_non_minified_js()
{
    wp_deregister_script('woo-variation-gallery');
    wp_dequeue_script('woo-variation-gallery');

    wp_enqueue_script('woo-variation-gallery', esc_url(plugins_url() . '/woo-variation-gallery/assets/js/frontend.js'), array(
        'jquery',
        'wp-util',
        'woo-variation-gallery-slider',
        'imagesloaded',
        'wc-add-to-cart-variation',
    ), WOO_VG_VERSION, true);
}