我试图使用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)