No Code Attached Yet
avatar C-Lodder
C-Lodder
6 May 2020

The majority of Joomla's core JS is written in ES2015+ which is great, but when loading either the frontend or backend, it loads the ES2013 files.

Does Joomla plan on adding the ability to load the .es6.js files?

avatar C-Lodder C-Lodder - open - 6 May 2020
avatar joomla-cms-bot joomla-cms-bot - change - 6 May 2020
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 May 2020
avatar HLeithner
HLeithner - comment - 6 May 2020

The es2013 files are only for developers that need then for legacy browser support.

Sadly nobody did a pr to move to es6 and fall back to oder versions.

avatar dgrammatiko
dgrammatiko - comment - 6 May 2020

Sadly nobody did a pr to move to es6 and fall back to oder versions.

Well, that was the intention right from the beginning but due to lack of contributors the ES6 project was never finalised. The only tasks remaining:

  • use a bundler (I would go for rollup an ditch the Webpack)
  • edit the HTMLHelper and the new Assets to actually always echo both the ESM and ES5 files (the esm will get an attribute type=module and the ES5 will get an attributes defer=defer + nomodule)
  • Append all the inline scripts at the end of the document (reason: the defer attribute is not working for ES5 scripts)
  • Patch the B/C break created by deferring all the scripts (it's doable, I've done it as an experiment)
  • Enjoy the future...
avatar HLeithner
HLeithner - comment - 7 May 2020

Aren't that multiple things? I mean using es6 files doesn't force us to use deferring / type=module or loading script at the end of the HTML correct?

First it would be great if we don't load the < es6 files per default.

avatar dgrammatiko
dgrammatiko - comment - 7 May 2020

First it would be great if we don't load the < es6 files per default.

You have 2 options:

  • Do server side sniffing
  • Do Client Side Feature detection

If you use type=module/nomodule you're effectively doing feature detection. This is the most efficient option. The only drawback as I mentioned above is that type=module is by default (and cannot be changed) deferred. Thus all the rest for the inline scripts. This is the industry standard, if you decide to do something different you're gonna be again the black sheep...

Add a Comment

Login with GitHub to post a comment