GulpUglifyError 使用 gulp-webpack-vs2015

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_modules\gulp-uglify\node_modules\uglify-js\tools\node.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 依赖于 UglifyJS Issue with Babel, ES6 and Uglify,因此无法正常工作。另一方面,他们鼓励改用 uglify-js-harmony。但是还在看gulp-uglify\node_modules\uglify-js。我如何强制 gulp 指向 uglify-js-harmony?

谢谢

这个问题与我的另一个问题有关,而且只需要部署需要的文件,或者在上述情况下排除节点模块文件夹:

tsconfig.json

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

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

"exclude": [
    "node_modules"
  ]