Angular-cli: 'ng build --prod' failing with es5 as target

Created on 8 Aug 2017  路  4Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.


1.2.7
Also seen on 1.2.1 before I updated in an attempt to fix

Repro steps.


ng build --prod

The log given by the failure.


ERROR in vendor.749569c349ba199c26dd.bundle.js from UglifyJs
Unexpected token: name (Decoder) [vendor.749569c349ba199c26dd.bundle.js:26296,6]

I know there are many issues similar to this but I have been unable to fix it using the suggestions. I have tried setting my target to 'es5' and this doesn't help. The UglifyJSWebpackPlugin fix doesn't seem to be possible without configuring the build completely myself.

I should note, where ever this Decoder class is coming from, it's not in code I've written (which seems to make sense given it's in vendor) and I have no way to find out where it is coming from. It may well be an unused library but it's tricky to track down (a quick grep shows at least 5 "Decoder" classes in my node_modules".

RFC / discussion / question

Most helpful comment

This is still not supported, but just for tracking it down, I recommend doing ng build --prod --sourcemap - that will give you the exact location of the error

All 4 comments

One of your third party libraries is shipping es6+ code, but we don't support building that at the moment (https://github.com/angular/angular-cli/issues/2907).

It's not very easy to track it down because that code just breaks the build process. My advice is to do ng serve (without --prod) instead and search the vendor bundle (with sourcemaps) for a third party lib that has (Decoder).

This is still not supported, but just for tracking it down, I recommend doing ng build --prod --sourcemap - that will give you the exact location of the error

Fantastic, thanks @AmitMY. Just in case anyone hits the same issue, I found the culprit: the cbor library required by autobahn.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings