3

I've integrated BabelJS into my workflow. This allows me to use ES6 features. I'm using gulp to convert my Javascript to ES5 Javascript.

I imagine that it would be better, though, to just use my ES6 code directly in newer browsers that support it. Is there a way to check for the availability of ES6 and use a BabelJS converted file only as a fallback?

nizzle
  • 1,036
  • 2
  • 10
  • 23
  • At this stage, no browser supports ES6, not event FF supports it completely, so precompiling/transpilling is the best option for now – Tushar Oct 07 '15 at 07:21
  • 2
    [Related](http://stackoverflow.com/questions/30586137/use-native-es6-and-transpiling-when-needed). Remember also that Babel only transpiles *language* features which can't be achieved via polyfill. The [Babel polyfill](https://babeljs.io/docs/usage/polyfill/) will use native ES6 functions where available – CodingIntrigue Oct 07 '15 at 07:29

1 Answers1

1

Of course there is, but it's a lot of hard work. Similar approaches are being used to navigate a mobile client to a dedicated URL, but do you really want to start mapping each feature used in your code base, and then checking each and every feature in the client?

Stick with transpiling client code for now. It might be better in the future.

Amit
  • 45,440
  • 9
  • 78
  • 110