4 ms·
Yes, you can transpile ES6+ to ES5 for client-side applications using Babel.
by yunyu 9y ago
Yes, you can transpile ES6+ to ES5 for client-side applications using Babel.
- macavity23 9y agoNot only can you, everyone who uses it does :)
- placebo 9y agoTrue, but admittedly, I'm so fond of the ability to have no "middlemen" between the code I write and what gets run by the browser that my dislike for any logistics/bureaucracy overhead is stronger than my attraction to ES6+ (or CoffeesScript for that matter). I know it might sound a bit irrational (I'd much rather code in C++ than code in assembly), but I think one of the perks of writing in JavaScript was that I got to have a high level language directly run by a system and now I don't want to give it up. I prefer to wait until the percentage of browsers that support ES6+ goes up.
- acoard 9y agoIn that case, use var. There is no production ready polyfill for let. I'd recommend editing your original question and putting your requirement of not using any buildtools or transpillation in, because it's the salient factor here and for most questions you'd ask regarding JS. >but I think one of the perks of writing in JavaScript was that I got to have a high level language directly run by a system and now I don't want to give it up. Out of curiosity, what do you see you're giving up? Is it the theoretical knowledge that the code exactly as written is being interpreted? I find that the compiled code is very human readable nowadays, and with sourcemaps it's not an issue at all as browser dev tools will directly link to the source files instead of the compiled files. I used to think I was giving up something until I worked with such a setup.
- placebo 9y agosorry, missed your reply (so perhaps you won't see this for the same reasons) but anyway: Mainly the feeling of giving up simplicity. Adding things (such as sourcemaps and any relevant configuration changes) usually detracts from the sense of "no middleman", although I know "no middleman" is always an illusion, it's less obvious when you don't have to do anything to create it.