Add js with custom type
You can do this in hook_preprocess_html():

function theme_preprocess_html(&amp;$var) {
  $script = [
    '#tag' =&gt; 'script',
    '#attributes' =&gt; [
      'type' =&gt; 'module',
      'src' =&gt; 'path/to/script.js',
    ],
    '#value' =&gt; '',
  ];
  drupal_add_html_head($script, 'script');  
}