GulpUglifyError using gulp-webpack-vs2015



我有以下错误

events.js:160
      throw er; // Unhandled 'error' event
      ^
GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token: punc ({) (line: 15, col: 7, pos: 1014)
Error
    at new JS_Parse_Error (eval at <anonymous> (C:..node_modulesgulp-uglifynode_modulesuglify-jstoolsnode.js:1:0), <anonymous>:1545:18)

package.json

"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0",
"gulp-sourcemaps": "^2.1.1",
"gulp-typescript": "^3.0.2",
"gulp-uglify": "^2.0.0",
"uglify-js-harmony": "^2.6.2"

在寻找答案之后,它看起来像gulp-uglify依赖于Babel, ES6和Uglify的UglifyJS问题,因此它不能正常工作。另一方面,他们鼓励使用ugly -js-harmony代替。但仍然在看gulp-uglifynode_modulesuglify-js。我怎样才能让gulp指向uglify-js-harmony呢?

谢谢

这个问题与我的另一个问题Gulp错误与angular2有关,也有必要只部署需要的文件,或者在上述情况下排除节点模块文件夹

tsconfig.json

"files": [
    "angularApp/app/app.module.ts",
    "angularApp/main.ts"
  ],

或排除(最好只包括需要的文件而不是排除所有节点模块)

"exclude": [
    "node_modules"
  ]

相关内容

  • 没有找到相关文章

最新更新