本文介紹了GulpUglifyError:無法縮小 JavaScript的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我正在嘗試縮小我正在使用 gulp 任務運行程序的腳本文件我正在嘗試 gulp-uglify 插件
I am trying to minify my script files for which i am using gulp task runner And I am trying gulp-uglify plugin
代碼:
gulp.task('concat', function() {
return gulp.src('app/**/*.js')
// .pipe(concat('script.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist/'))
});
但我收到錯誤
當我嘗試將 gulp 任務作為 gulp concat 運行時任何幫助將不勝感激
when i try to run gulp task as gulp concat Any help would be appreciated
推薦答案
主要錯誤是在使用 ES6 格式時產生的.使用 gulp-uglify-es 模塊而不是 'gulp-uglify' 來克服這個錯誤.
The main error is generated when you're using ES6 format. Use the gulp-uglify-es module instead of 'gulp-uglify' to overcome this error.
var uglify = require('gulp-uglify-es').default;
注意:gulp-uglify-es 不再維護.您可能想使用 terser
/gulp-terser
代替:
Note: gulp-uglify-es is no longer being maintained. You may want to use terser
/gulp-terser
instead:
這篇關于GulpUglifyError:無法縮小 JavaScript的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!