The ReorderHead transformer uses the extension name to deduplicate scripts for a same extension. This means that if multiple <script> elements use the same extension name (like for .mjs script + nomodule fallback), they are "deduplicated" and one of these gets lost.
The
ReorderHead
transformer uses the extension name to deduplicate scripts for a same extension. This means that if multiple<script>
elements use the same extension name (like for.mjs
script +nomodule
fallback), they are "deduplicated" and one of these gets lost.The ReorderHead transformer needs a more robust algorithm for deduplication that takes the requirement for two
<script>
elements for ESM into account. Here's what the Go version is doing: https://github.com/ampproject/amppackager/commit/8e2622daa536d5d49dbb6c80f39cbffe65053f72#diff-4e49b75e7da4b38f1a1be19bfc9c6b9e12dbe964eda574cf83ee419776c782f0R80-R94