我有一個gulp.task 'scripts'
,它使用gulp-uglify
。然後我又添加了gulp-import
,它沒有工作。如果我只有uglify
它的作品。如果我只有import
它的作品。但是,如果我在同一時間都做不到這一點。 下面是函數:gulp-include with gulp-uglify不起作用
gulp.task('scripts', function(){
gulp.src([
'testgulp/**/*.js', '!testgulp/**/_*.js', '!testgulp/**/*.min.js'
])
.pipe(include()) //if I comment only this line, uglify works
.on('error', console.log)
.pipe(uglify()) //if I comment only this line, include works
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(function(file) { return file.base; }));
});
,然後在終端我有這種反應的時候儘量做到既:
/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/map-stream/index.js:103
throw err
^
GulpUglifyError: unable to minify JavaScript
at createError (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/lib/create-error.js:6:14)
at wrapper (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/node_modules/lodash/_createHybrid.js:87:15)
at trycatch (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/minifier.js:26:12)
at DestroyableTransform.minify [as _transform] (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/gulp-uglify/minifier.js:76:19)
at DestroyableTransform.Transform._read (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
at DestroyableTransform.Transform._write (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
at doWrite (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:313:64)
at writeOrBuffer (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:302:5)
at DestroyableTransform.Writable.write (/Applications/MAMP/htdocs/git/personal-sandrina-p/_main/v3/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:241:11)
at Stream.ondata (stream.js:31:26)
我從考拉應用程序和附加/添加功能搬走是真棒,所以我想和Gulp一樣。我嘗試了gulp-include和gulp-import,兩者都有同樣的問題。我做錯了什麼? 謝謝:)
CNC中 我也嘗試一口同步和硬編碼在minifyit任務超時(),但不解決問題......
我也試過,但沒有修復。問題是在我使用JavaScript的速記上...檢查我自己的答案上面有更多詳細信息 –