I couldn't figure out how to do this when migrating from drupal_add_js(), but it looks like it's just a matter of adding the key header: true in the libraries.yml file.

See line 324 here: https://api.drupal.org/api/drupal/core!core.libraries.yml/8

Comments

carwin created an issue. See original summary.

  • bd8648c committed on 8.x-1.x
    Issue #2627732 by carwin: Forces script to load in the header.
    
carwin’s picture

Status: Active » Fixed

Fixed this in the 8.x-1.x-dev branch.

carwin’s picture

And now it's in 8.x-1.1.

rupl’s picture

my hero! \o/

carwin’s picture

Status: Fixed » Closed (fixed)