GulpUglifyError: unable to minify JavaScript Caused by: SyntaxError: Unexpected token: keyword const
Updated: 11th December 2021
Tags: javascript gulp
Issue
gulp-uglify doesn’t support ES6 (JavaScript ECMAScript 6), so you need other tool.
Fortunately, there is another package which do same thing and have same command.
Solution
- Type this to install gulp-terser
npm install gulp-terser --save-dev
- Change gulp-uglify to
const uglify = require("gulp-terser");