Reputation: 15734
I'm using babel with gulp (.pipe($.babel())
), and it seems to work for most things but is not working for Array.from
.
It works fine when running babel-node
:
$ ./node_modules/babel/bin/babel-node.js
> Array.from
[Function: from]
But when the following code is processed with gulp:
var foo = () => { console.log(Array.from) }
The transpiled source is:
var foo = function foo() {
console.log(Array.from);
};
And the console output when I execute foo
is:
undefined
Upvotes: 18
Views: 9306
Reputation: 15734
Ended up solving this myself while writing my question, but figured I'd finish and answer myself to help future searchers:
There are certain features of babel that require a polyfill loaded in the browser due to limitations of ES5. This is loaded automatically in babel-node
or you can include with with babel-polyfill.
Some of the features requiring the polyfill:
Upvotes: 15