How do I remove a module JavaScript file through a theme? I need to remove a JavaScript file added from a module through a theme. How can I achieve this?
Implement hook_library_info_alter:

mytheme.theme:

/**
 * Implements hook_library_info_alter().
 */
function mytheme_library_info_alter(&amp;$libraries, $extension) {
  if ($extension === 'some_module') {
    unset($libraries['some_module.library']['js']['js/foo.js']);
  }
}