Gulp Uglify不断发现不必要的错误

时间:2015-12-08 08:56:58

标签: gulp

我正在使用Gulp将所有库文件(jQuery,jQuery插件,自定义插件)捆绑到1个文件中,并使用uglify将其最小化。

但是,在运行gulp命令时,控制台会不断抛出错误。我使用gulp-util查看错误出现的位置,但在查看代码时,它实际上是合法的,没有任何错误。

我知道代码没有错误,因为它们是我从网站上下载的库文件,并且在被包含时它们正常工作。

不确定为什么uglify会继续选择错误。例如:

$ gulp
[16:51:19] Using gulpfile C:\wamp\www\example.com\gulpfile.js
[16:51:19] Starting 'lib-scripts'...
[16:51:20] { [Error: C:\wamp\www\example.com\app\webroot\dist\lib.min.js: Unexpected token: punc (()]
  message: 'C:\\wamp\\www\\example.com\\app\\webroot\\dist\\lib.min.js: Unexpected token: punc (()',
  fileName: 'C:\\wamp\\www\\example.com\\app\\webroot\\dist\\lib.min.js',
  lineNumber: 11296,
  stack: 'Error\n    at new JS_Parse_Error (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1526:18)\n    at js_error (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1534:11)\n    at croak (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2025:9)\n    at token_error (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2033:9)\n    at unexpected (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2039:9)\n    at eval (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2205:17)\n    at eval (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2072:24)\n    at block_ (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2352:20)\n    at eval (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2325:25)\n    at function_ (eval at <anonymous> (C:\\wamp\\www\\example.com\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2330:15)',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-uglify' }

该行的代码是

...
ctx.lineTo(rightX, this.base);
ctx.fill();
if (this.showStroke){
    ctx.stroke();
}
...

哪个是库文件的一部分,并且没有任何错误。

0 个答案:

没有答案
相关问题