By default, Drupal ensures that JavaScript is placed last on the page. This improves the page's load performance by allowing the critical portions of the page to load first. Placing JavaScript in the header is now an opt-in option.
In order to render a library in the header, you will need to add the header: true key/value pair:
js-library:
header: true
js:
js/myscripts.js: {}
This will load a custom JavaScript library and its dependencies into the header of a page.