Adding core Javascript libraries in my_module.libraries.yml I've read Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 module and I can see where you can add assets that are part of your module or from a CDN or external source. What about if that library you want to add is already a core asset?

I'm trying to add jquery.ui.accordion to my modules so in my *.libraries.yml I have:

my_module:
  js:
    /core/assets/vendor/jquery.ui/ui/widgets/accordion-min.js: { minified: true }
  dependencies:
    - core/jquery.ui
    - core/jquery.ui.widget


That library is never loaded. What am I missing? Is there a better way to add core assets to my module?

EDIT: I've also tried different paths like:

core/assets/vendor/jquery.ui/ui/widgets/accordion-min.js: { minified: true }
../../../core/assets/vendor/jquery.ui/ui/widgets/accordion-min.js: { minified: true }
I just scraped the MY_MODULE.libraries.yml and utilized one of the other methods of adding assets, by:

function MY_MODULE_page_attachments(array &amp;$attachments) {
  $attachments['#attached']['library'][] = "core/jquery.ui.accordion";
  //new addition below
  $attachments['#attached']['library'][] = "MY_MODULE/MY_MODULE.accordion";
}


This works for me. Perhaps you don't need a MY_MODULE.libraries.yml if you are trying to add libraries that already exist in core.

Edit: So I still have a MY_MODULE.libraries.yml file however it now just adds my module's javascript (with a dependency to jQuery). It's just some Javascript that initializes jQuery UI accordions. I still use the code above to add jQuery
s UI accordion javascript and my own.