How to force a JavaScript library to load in the  of a Drupal 8 page
header: true needs to go under your js declaration, not within each file.

See: https://www.drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-theme


  By default, all JS assets are now loaded in the footer. Being loaded
  in the header is now an opt-in choice, that is only necessary for
  critical UI elements that cannot be shown unless their corresponding
  JS has already run.


js-header:
  header: true
  js:
    header.js: {}

js-footer:
  js:
    footer.js: {}



  You have to set the new header property on asset library definitions
  to true, to indicate that the JavaScript assets in that asset library
  are in the critical path, and should therefore be loaded from the
  header. Note that any dependencies — direct and indirect — of asset
  libraries marked as being in the critical path are also automatically
  loaded from the header, so you don't need to worry about dependencies
  being unavailable.