我遇到以下错误
ready_to_rock? or raise "Not ready!"
的package.json
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)
在寻找答案后,看起来gulp-uglify依赖于UglifyJS Issue with Babel, ES6 and Uglify,因此它无法正常工作。另一方面,他们鼓励使用uglify-js-harmony代替。但仍然在看gulp-uglify \ node_modules \ uglify-js。我怎样才能强迫gulp指向uglify-js-harmony呢?
谢谢
答案 0 :(得分:1)
此问题与我的其他问题Gulp error with angular2有关,还需要仅部署所需文件,或者在上述情况下将节点模块文件夹排除为:
tsconfig.json
"files": [
"angularApp/app/app.module.ts",
"angularApp/main.ts"
],
或排除(最好只包括需要文件而不是排除所有节点模块)
"exclude": [
"node_modules"
]