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: ampproject/amppackager@8e2622d#diff-4e49b75e7da4b38f1a1be19bfc9c6b9e12dbe964eda574cf83ee419776c782f0R80-R94
The
ReorderHeadtransformer 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.mjsscript +nomodulefallback), 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: ampproject/amppackager@8e2622d#diff-4e49b75e7da4b38f1a1be19bfc9c6b9e12dbe964eda574cf83ee419776c782f0R80-R94