General developer forum

ES6 support in grunt uglify?

 
Picture of Dave Balch
ES6 support in grunt uglify?
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Hi,

I'm looking at using a 3rd-party JS library in a plugin, but it uses ES6 - which isn't supported by the version of uglify set in package.json for M3.3 - it chokes with parse errors on the new syntax. Fortunately, there's a ES6 compatible "harmony" branch of UglifyJS, which is compatible.

Changing package.json from

"grunt-contrib-uglify": "1.0.1",
to
"grunt-contrib-uglify": "gruntjs/grunt-contrib-uglify#harmony",

...and running `npm update` fixes the parse errors, and is presumably backwards-compatible - unfortunately I can't run Behat at the moment to run check for regressions.


Would I be right in thinking that grunt-contrib-uglify will need to merge their ES6 support into their main release, before Moodle can adopt it?

Cheers,
Dave.

 
Average of ratings: -
Picture of Dave Balch
Re: ES6 support in grunt uglify?
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
As it turns out, I can probably just use Babel to transpile the lib to something that Moodle's Uglify is happy with. Updates to ES6 can happen (much) later on.
 
Average of ratings: -