I got this error when trying to get two output in a single task
I want an index.js
in dist/
, and index.min.js
in the same folder.
gulp.task('clean', (cb) =>
del('dist/', cb)
);
gulp.task('scripts', ['clean'], () =>
gulp.src('src/**.js')
.pipe($.sourcemaps.init())
.pipe($.babel())
.pipe($.sourcemaps.write())
.pipe(gulp.dest('dist/'))
.pipe($.uglify({preserveComments: 'some'}))
.pipe($.rename({ extname: '.min.js' }))
.pipe($.size({title: 'scripts'}))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest('dist/'))
);
This is the error:
[19:48:55] Requiring external module babel-core/register
[19:49:00] Using gulpfile ~/projects/ar-string/gulpfile.babel.js
[19:49:00] Starting 'clean'...
[19:49:00] Finished 'clean' after 19 ms
[19:49:00] Starting 'scripts'...
events.js:85
throw er; // Unhandled 'error' event
^
Error
at new JS_Parse_Error (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1508:18)
at js_error (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1516:11)
at croak (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2008:9)
at token_error (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2016:9)
at unexpected (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2022:9)
at semicolon (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2042:43)
at simple_statement (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2222:73)
at eval (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2095:19)
at eval (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2055:24)
at block_ (eval at <anonymous> (/home/mohamed/projects/ar-string/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2335:20)
Note: i think the error is in babel