Review 13.4 Merged

88778[TASK] Render JavaScript modules as script tag if possible

Benjamin Franzke CR +2 V +2 Normal +150 −30 updated 03/26/25, 17:52

Commit message

With the removal of es-module-shims in #101372 it is possible[1]
to add a fastpath for JavaScript modules that do not require
initializer methods to be called.

The fastpath is activated for modules that match the mentioned
requirements, in order to avoid mixing explicit module script
tags and @typo3/core/java-script-item-handler.js invocations.

This allows the browser to load the set of modules from the list
of <script type="module"> tags while global configuration is written
as plain JSON and the intermediate module java-script-item-handler.js
is delayed (or skipped if possible).

Note that `litNonce` is migrated to use global assignment
infrastructure to be guaranteed to be rendered after the importmap
in order to prevent occasional false-positive errors in Firefox 115
> Uncaught TypeError: The specifier "@typo3/backend/modal.js" was
> a bare specifier, but was not remapped to anything.
(The backend and all actions would have worked, as all scripts are
loaded despite of these errors, but javascript console would be
flooded with these message. This is fixed in Firefox 116 and
was triggered because `<script type="importmap">` has not
been placed as first `<script>` element on the page.)

[1] we do not longer need to care about missing support for
    `import()` expressions in `<script type="module" src="…">`
    tags, which were only supported via a fail-first algorithm
    in es-module-shims, and have therefore not been used back then

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
  • Verified V +2 Done
    • Benjamin Franzke +2
    • core-ci +1 CI

Issues 2

Files 5

Review log 34

  1. Benjamin Franzke commented on patch set 1 03/26/25, 17:41

    Cherry Picked from branch main.
  2. Benjamin Franzke voted on patch set 1 CR +2 V +2 03/26/25, 17:42

  3. core-ci voted on patch set 1 V +1 03/26/25, 17:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76394

  4. Benjamin Franzke merged patch set 2 03/26/25, 17:52