? J4 Issue ?
avatar C-Lodder
C-Lodder
11 Dec 2018

The Uglify-ES package is no longer maintained.

You should update to Terser which is a fork that retains API and CLI compatibility.

avatar C-Lodder C-Lodder - open - 11 Dec 2018
avatar joomla-cms-bot joomla-cms-bot - change - 11 Dec 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Dec 2018
avatar C-Lodder C-Lodder - change - 11 Dec 2018
The description was changed
avatar C-Lodder C-Lodder - edited - 11 Dec 2018
avatar dgrammatiko
dgrammatiko - comment - 15 Dec 2018

FWIW uglify-es is only used for ES5 since the last or for the build tools. The reason is that either uglify-we or any other minifying script is useless now that we use the Babel minifier, which btw is the only one that can be trusted, check the react repo for the bugs from uglify-es

avatar C-Lodder
C-Lodder - comment - 15 Dec 2018

But with Fedik's PR, ES6 files will be shipped and thus need to be minified. Uglify doesnt support ES6

avatar dgrammatiko
dgrammatiko - comment - 15 Dec 2018

That approach is also wrong. In order to ship esXXXX code you need to use module/nomodule in the script tags. That's what everybody else is doing. The approach to keep thinking on es5 terms for ESXXX is plain wrong...

avatar dgrammatiko
dgrammatiko - comment - 15 Dec 2018

Uglify doesnt support ES6

For Esxxxx you can use babel without transpiling, just minifying. Check the code in the build tools this is already supported:

const settings = [
    {
        presets: [
            ['@babel/preset-env', {
                targets: {
                    browsers: ["ie 11"]
                },
                modules: false
            }],
        ],
        plugins: [
            ['add-header-comment', { header: [headerText] }],
            ['@babel/plugin-transform-classes']
        ],
        comments: true
    },
    {
    presets: [
        ['@babel/preset-env', {
            targets: {
                browsers: ["ie 11"]
            },
            modules: false
        }],
        "minify"
    ],
    plugins: [
        ['@babel/plugin-transform-classes']
    ],
    comments: false
}
];

Those settings are used to transpile to es5, but you can have a copy of them with browsers: ["last 2 versions"] and voila ES6 minified (and also transpiled any newer feature to the minimum browser that Joomla wants to support)...

avatar C-Lodder
C-Lodder - comment - 16 Dec 2018

Yes browser detection is wrong. Should be feature detection, but then all assets will need to be lazy loaded.

avatar dgrammatiko
dgrammatiko - comment - 16 Dec 2018

Actually Joomla can use feature detection without lazy loading the scripts:
screenshot 2018-12-16 at 11 21 51

https://philipwalton.com/articles/deploying-es2015-code-in-production-today/

As always there are some caveats: scripts need to be ALWAYS deferred (otherwise the order of execution might be messed up), but this is the recommended best practice so at some point ppl should accept it and move forward...

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Category Code style
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J4 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 7 Apr 2019
Labels Added: ?
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 7 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 9 Apr 2019
Category Code style
avatar C-Lodder C-Lodder - change - 10 Apr 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-04-10 07:42:12
Closed_By C-Lodder
avatar C-Lodder C-Lodder - close - 10 Apr 2019

Add a Comment

Login with GitHub to post a comment