Override core Js file Working on my theme
I need to override a core Js file ..\core\modules\contextual\js\contextual.js
My code from theme.info
libraries-override:
  contextual/drupal.contextual-links:
    js:
      js/contextual.js: js/override/contextual.js

The problem is that the loading order of this component js files did change after the override which cause script errors :

So how can override file js core and still same order file?
Thanks can be done with with the hook_js_alter function

    function hook_js_alter(&amp;$javascript) {        
    $javascript['js/contextual.js']['data'] = drupal_get_path('theme', 'THEMENAME') . 'js/override/contextual.js';
    }