?
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: ?
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...

avatar brianteeman
brianteeman - comment - 8 Apr 2021

@dgrammatiko @Fedik is there anything to do here? Has it been resolved? Is it a non-issue?

avatar dgrammatiko
dgrammatiko - comment - 8 Apr 2021

Has it been resolved?

Yup, Joomla is using the type=module/nomodule attributes so effectively 2017+ browsers get the ES6 files and older browsers get the ES5. I think we can close this

avatar brianteeman
brianteeman - comment - 8 Apr 2021

Thought so.

@Quy please close

avatar Quy Quy - change - 8 Apr 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-04-08 22:16:56
Closed_By Quy
avatar Quy Quy - close - 8 Apr 2021

Add a Comment

Login with GitHub to post a comment