小编Ale*_*der的帖子

Uglify SyntaxError:意外的令牌:punc())

我试图使用gulp来缩小包含JS文件的文件夹.但是,其中一个文件存在上述错误,导致其无法缩小.

我设法抓住并打印了错误,我在这里部分打印过:

JS_Parse_Error {
 message: 'SyntaxError: Unexpected token: punc ())',
 filename: 'ex.js',
 line: 189,
 col: 25,
 pos: 6482,
 stack: Error\n    at new JS_Parse_Error (eval at <anonymous> ... ) 
 plugin: 'gulp-uglify',
 fileName: '.../js/ex.js',
 showStack: false
}
Run Code Online (Sandbox Code Playgroud)

有问题的文件包含以下内容,缩写为:

function() {
  ...
  $.confirm({
    buttons: {
        confirm: function() {
            $.post('/ajax-handler', {
                    ...
                })
                .done( function(response) {
                    var data = filterResponse(response);
                    if (data['status'] == 'success') {
                        sleep(1000).then(() => {
                    *       ...
                        });
                        sleep(5000).then(() => {
                            ...  
                        });

                    } else {
                        console.log('Oops!');
                    }
                })
                .fail( function(err, …
Run Code Online (Sandbox Code Playgroud)

javascript gulp gulp-uglify

55
推荐指数
5
解决办法
5万
查看次数

标签 统计

gulp ×1

gulp-uglify ×1

javascript ×1