Cocos Creator TypeScript Build GulpUglifyError

Cocos Creator TypeScript Build GulpUglifyError
0.0 0

[8828] Error: Build Failed: GulpUglifyError: unable to minify JavaScript
Caused by:     SyntaxError: Unexpected token: keyword (const)
File: /Users/.../Projects/.../project.js
Line: 619
at createError (/Applications/
    at apply (/Applications/
    at wrapper (/Applications/
    at /Applications/
    at DestroyableTransform._transform (/Applications/
    at DestroyableTransform.Transform._read (/Applications/
    at DestroyableTransform.Transform._write (/Applications/
    at doWrite (/Applications/
    at writeOrBuffer (/Applications/
    at DestroyableTransform.Writable.write (/Applications/
    at Async.series.t (/Applications/
    at /Applications/
    at /Applications/
    at /Applications/
    at /Applications/
    at /Applications/
    at /Applications/
    at Gulp.doneCallback (/Applications/
    at Gulp.Orchestrator.stop (/Applications/

I understand that it’s the JS uglifier that finds a const (I obviously have a lot of them in my TypeScript project). Why doesn’t it first transpile the code to ES5 and then uglify it? How can I get this error all of a sudden?

I’ve tried with both Cocos Creator 1.8.0 and 1.7.2.

How can I fix this?


Figured out the issue. My project included third party library that was in ES6. I guess you can only use ES5 transpiled third party libraries with CC build?