How to add a js script as type="module" How to add type=&quot;module&quot; to script added in MODULENAME.libraries.yml when i do:
my-library:
  version: 1.x
  js:
    js/App.js: { }

I get
&lt;script src=&quot;/modules/custom/MODULENAME/js/App.js?v=1.x&quot;&gt;&lt;/script&gt;

I need to add type=&quot;module&quot; to script tag like:
&lt;script type=&quot;module&quot; src=&quot;/modules/custom/MODULENAME/js/App.js?v=1.x&quot;&gt;&lt;/script&gt;

I have tried:
my-library:
  version: 1.x
  js:
    js/App.js: { type: module }

But i doesn’t work.
Is this possible to add a script of type module?
Yes, it is possible, with the attributes property.
my-library:
  version: 1.x
  js:
    js/App.js: { attributes: { type: module } }

See Adding attributes to script elements and JS properties.