3
votes

I'm working on a electron app written with Typescript and React. I'm currently using webpack and babel in the build process to package and transpile the Typescript code to es6 (tsc loader) and then es5 (babel).

Since V8 supports almost all features of ES6 already [1], is it really still necessary to use the babel transpiler to build ES5?

A quick test showed that my code works perfectly when just removing babel form the webpack loaders (while targeting commonjs modules rather than ES6 modules). Some ES6 features I want to use are:

  • Promises
  • async/await (ES7 but available in TypeScript >= 1.7 when transpiled to ES6 [2])
  • destructuring / spread operator

[1]: ES6 Compatibility Table [2]: TypeScript 1.7 Release Notes

1

1 Answers

1
votes

If you test it and it works, good!

A thing to remember is that sometimes (looking at non-V8 here mostly) the features might have bugs as well as the need to pay attention to version history.

I think the hidden blade here is the potential for migrating the code, because it might have to work in an ES5 environment at some point, when you might find (for whatever darn reason, this is JS/TS after all) that re-enabling trans-piling brakes your code/tests/workflow.

From a server side typescript perspective, I target ES6 for Node v6.6, because I'm fairly willing to risk dealing with issues if I have to target a platform with older node.

One last note is that despite TC39's ECMAScript2015 / ES6, Firefox and Chrome are opposing implicit tail calls, so that's a bit of a minefield.