Review main Merged

85868[TASK] Response with MIME type application/javascript for mjs file ending

Josef Glatz CR +2 V +2 Easy +1 −1 updated 01/02/25, 10:06

Commit message

This patch adds the instructions to handle ECMAScript javascript files
'.mjs' with the correct MIME type.

The mjs file ending is already used by public packages. The different
file ending helps the distinction between modules and classic scripts.

It helps for clear communication within projects: By using the .mjs
extension, developers and build systems can easily recognize that a file
is an ECMAScript module, ensuring that the proper syntax and semantics
(such as 'import' and 'export') are used. This approach is widely common
in node projects.

While not every webserver is adding the correct MIME type for '.mjs'
it's now clearly configured within TYPO3 projects out of the box.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1

Issues 1

Files 1

Review log 1314

  1. Josef Glatz uploaded patch set 1 09/04/24, 11:40

  2. Josef Glatz commented on patch set 1 09/04/24, 11:42

    This change is ready for review.
  3. core-ci voted on patch set 1 V +1 09/04/24, 11:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64751

  4. Garvin Hicking voted on patch set 1 CR +1 V +1 09/04/24, 12:41

  5. Josef Glatz commented on patch set 1 09/04/24, 12:41

    Is here an rSt necessary for htaccess changes?
  6. Garvin Hicking commented on patch set 1 09/04/24, 12:46

    Reply

    Hehe. I wrote a few sentences about this initially and then decided it would be superflous. But here it is: I don't think an RST file for this is needed, because it affects configuration that existing projects must configure for themselves, as they have to maintain their webserver configuration themselves, too. Having this as a "sane default" makes sense. But as long as TYPO3 itself does not emit .mjs files on its own (which it doesn't as of now) I don't see that we should enforce this with an important-rst. When people use .mjs, they can add it to their existing configuration.
  7. Josef Glatz commented on patch set 1 09/04/24, 12:47

    I can write one. I'm also not 100% sure if necessary.
  8. Simon Praetorius commented on patch set 1 09/04/24, 14:12

    I think if we add mjs, we should also add cjs
  9. Josef Glatz commented on patch set 1 09/05/24, 08:41

    I will take a look into the git history of htaccess related commits tomorrow.

    Reply

    I'm not that deep into JS. Is CommonJS with `require` still used widely? If yes, I will update my patch, of course!
  10. Garvin Hicking commented on patch set 1 09/05/24, 09:08

    Reply

    I agree with Simon, shouldn't hurt to make it complete here, even though usage may decrease. the filename extension is burned, and hopefully no one comes up with a terrible idea to use cjs for some non-javascript filetype 😱

    Reply

    I checked that, mjs/cjs was never part of it
  11. Benni Mack updated the commit message in patch set 2 CR +1 V +1 10/18/24, 13:49

  12. Garvin Hicking voted on patch set 2 CR +1 V +1 12/29/24, 14:22

  13. Stefan Bürk voted on patch set 2 CR +2 V +2 01/02/25, 09:58

  14. Stefan Bürk merged patch set 3 01/02/25, 10:06