Writing ES6 without a transpiler
I like modern JS features. I’ve been using some like const and let for a long time in specific contexts like Gecko chrome (when I worked on Flock & Songbird). Recently I’ve been playing with the features that have been standardized as ES6.
I tried a bunch of different build-system and transpiler approaches but I found them all unsatisfying. Even with automatic transpilation on save, even with source maps, I felt that I was missing too much of the edit/reload cycle that makes web JS programming such a pleasure. Even with low latency I couldn’t take advantage of things like being able to edit my source code inside the Chrome developer tools debugger.
Luckily stable Chrome supports a lot of ES6. Just restricting myself to that quite large subset gives me a great set of features to work with, without losing the development flow I like. Every six weeks I get more features to play with as a new Chrome release launches. When I want to deploy to older browsers I can transpile (Closure Compiler is great) and polyfill, but it’s part of the release / deployment flow rather than obstructing development.
So what am I using? Mostly:
- Arrow functions
- let and const
- New collection types — Map, Set, etc
It’s pretty nice.
Originally published at Ian McKellar.