GulpUglifyError: unable to minify JavaScript Caused by: SyntaxError when using let or const
Closed this issue · 4 comments
Alecto commented
I am using the latest version 3.0.1 and gulp 4.0.
Why is the minimization of js files not performed if there is a let or const in the code?
code in js that cannot handle the plugin.
'use strict';
let slideItems = document.querySelectorAll('.slides__item'),
indContainer = document.querySelector('.indicators'),
indItems = document.querySelectorAll('.indicators__item'),
currentSlide = 0;
const LEFT_ARROW = 37,
RIGHT_ARROW = 39,
SPACE = 32,
FA_PAUSE = '<i class="fas fa-pause"></i>',
FA_PLAY = '<i class="fas fa-play"></i>';
gulp 4 function for task (it works well with vars)
function minjs () {
return src([path.js.files, '!' + path.js.filesMin])
.pipe(uglify({
toplevel: true,
}))
.pipe(rename({ suffix: '.min' }))
.pipe(dest(path.js.folder)
.on('end', () => { if(true) console.log(' --------------- completed UGLIFY (.min.js)'); }));
}
RedactedProfile commented
Same issue
Alecto commented
I use gulp-uglify-es instead of this module, everything is fine with es6.
terinjokes commented
You should be able to use this module by following the instructions in the README and using the maintained fork of UglifyJS: Terser.
uglify-es is no longer maintained and breaks scripts.
terinjokes commented
You can do so right now, following the instructions in the readme. PRs
accepted to update the example to specifically reference it.
…On Mon, Mar 4, 2019, 7:12 AM DesWurstes ***@***.***> wrote:
Is there a plan to migrate this package to terser?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#344 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQsZcRqLAqLntRQFsYIdfpW4kCvugZXks5vTTftgaJpZM4X8Tjg>
.