Review main Merged

73112[TASK] Add and use includeJavaScriptModules in <f:be.pageRenderer>

Benjamin Franzke CR +2 V +2 Normal +103 −82 updated 01/21/22, 13:50

Commit message

Usages have been converted with:

  git grep -l includeRequireJsModules= | \
    grep -v /Documentation/Changelog/ | \
    grep -v PageRendererViewHelper.php | \
    xargs sed -i \
      -e 's/includeRequireJsModules=/includeJavaScriptModules=/' \
      -e "s/\\([0-9]: *'TYPO3\\/CMS\\/.*\\)'/\\1.js'/g"

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 2

Files 37

Show 17 more files

Review log 78

  1. Benjamin Franzke uploaded patch set 1 01/21/22, 10:32

  2. Benjamin Franzke wrote 01/21/22, 10:32

    Topic set to esm
  3. core-ci voted on patch set 1 V +1 01/21/22, 10:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22344

  4. Christian Kuhn voted on patch set 1 V +1 CR +1 01/21/22, 12:04

  5. Andreas Kienast voted on patch set 1 V +2 CR +2 01/21/22, 12:28

  6. Andreas Kienast merged patch set 2 01/21/22, 12:28

  7. Benni Mack commented on patch set 2 01/21/22, 12:29

    not a huge fan here... I'd rather use a <f:script> VH (or <f:asset.script>) to use this in the future? So we could have multiple of them, and use AssetRenderer and not PageRenderer directly.
  8. Benjamin Franzke commented on patch set 2 01/21/22, 13:50

    Reply

    yea, I'm not a huge fan of using viewhelpers that access global state-objects, but that's of course applies to both, AssetRenderer and PageRenderer. I think olly was right in not making JavaScriptRenderer a global object (was easy because PageRenderer is the global object that holds JavaScriptRenderer). But yea, it would be better to use AssetRenderer instead of PageRenderer. To be fair: I didn't have a deep look into AssetRenderer yet and how to integrate the modules there, mainly because I didn't need it, because the browsers would (per ECMAScript) specification never execute a module twice. (Thats very different between classical scripts and module scripts) But still, I think it's better if we emit one module only once, not multiple times. I actually think, currently the "cleanest" way would be to add the modules via ModuleTemplate (and that uses whatever is wants underneath) – because ModuleTemplate is an object, so it's fine to add data there. I know Christian added a lot of these viewHelper invocations with the recent patches, but maybe we can revisit that at some point.