Closed chemerisuk closed 9 years ago
I believe the problem here is that you use String#contains
that does not exist in ES5.
Submitted PR https://github.com/termi/es6-transpiler/pull/67 with the fix. Please merge it asap
+1
+1
What about the node version you're using?
I have this error with version 0.10.33. I'm thinking about using version 0.11.14 since it seems to support things like --harmony_strings
.
@nicoolas25 well, it will work on 0.11 I guess, but there are some environments where this version can't be used (yet), because it's not stable.
BTW recently String#contains
was renamed to String#includes
, so the first one is non-standard now. Details here: https://github.com/tc39/Array.prototype.includes#status
+1
.contains()
has been part of transpiler/RegExp.js
since March 2014, but only got added to transpiler/core.js
last August.
Alright, the real cause of the problem is https://github.com/paulmillr/es6-shim/commit/226517d3742fe382f8a5d07a9b3deb2e54c174c4 that the transpiler uses as a dependency. It explains why we started to have this error only recently.
Not sure if the project is maintained at present, but I found a workaround. You can fix es6-shim
to the robust version in your package.json
and add install
script that removes the dependency from es6-transpiler
. In such case the project will use parent version of es6-shim
that we specified above. Check example here https://github.com/chemerisuk/better-dom-boilerplate/commit/3f2412315ad2784525ddd77682cbdd6ad43e91a0
Err, shouldn't es6-transpiler simply upgrade to use .includes()
instead of .contains()
? That sounds like the simplest fix.
Yep, it should and the author will probably update this soon. In the meantime, we have the @chemerisuk workarround.
I can confirm, it works in 0.7.18. Therefore my workaround can be removed.
Noticed that the latest version fails to process immediately invoked function with
"use strict"
on the top:with error:
TypeError: Object ; has no method 'contains'
.Just FYI I'm using the project in scope of gulp-es6-transpiler.