> Babel transforms your JavaScript, You put JavaScript in, And get JavaScript out
That says all you need to know about the javascript ecosystem.
> Babel transforms your JavaScript, You put JavaScript in, And get JavaScript out
That says all you need to know about the javascript ecosystem.
You work out the minimum requirements and write to that, you don't start out with the latest and greatest and work backwards.
FE having a specific way of working, doesn't preclude that way being broken.
"That some field (e.g. FE) has a specific way of working is orthogonal to that way being broken or not".
Otherwise there would never be any brokenness conceivable ever, and everything would be a matter of different ways/conventions.
I don't see why brokenness shouldn't be a possibility in FE or anywhere else though. Sure, I might be wrong, and FE might NOT be broken. But that would not be the case merely because "it has its own way for doing things" -- it would have to be inherently not broken, whereas "has its own way" merely tells us that it's idiomatic.
You start with the damn requirements and then look at how the application may need to be built.
The latest browser APIs are not useful for 99% of the FE work going on out there. Yes, I know it's more satisfying to pretend that it is important, but it really isn't. Just because you can hook something up to a users webcam, or post annoying browser notifications about the latest cat picture a user uploaded doesn't mean you need to or even should.
FE is not a special snowflake. It's no different from most software development (and yes, other, non-FE developers have to figure out cross platform issues as well). If you want to be taken seriously in software development, then stop with the unprofessional attitude and learn how to do something useful for your users, like <a href="https://en.wikipedia.org/wiki/Progressive_enhancement">Progr... enhancement</a>.
the alternative you propose is that everyone writes code that only targets well-supported javascript, but does that exclude polyfills or convenience functions? Does that mean that using a polyfill for Array.prototype.map is worse than using an implementation like _.map or a hand-written map function? At best, this choice results in a complex maintenance burden that is borne by developers during future refactors (rather than an infra-focused developer upgrading the babel distribution and its presets/plugins)
the current reality is that the browser ecosystem remains heterogenous (which is why there is still a valid market for things like jquery). A plugin like babel-preset-env for instance allows you to dynamically adjust the "minimum requirements" without needing to write new polyfills and gives the benefit of improving the transformed code with little to developer intervention. It's computers doing what they're good at, i struggle to see the harm in that.
It seems to me that it's like trying to mix Ruby 1.8.7 and 2x in the same project and needing a tool to translate it into 1.9.3. Why not just write in 1.9.3 if that's the required target?
I clearly don't know what I'm talking about but what's wrong with actually just writing the JavaScript that Babel spits out? Why is something like Babel even tolerated? What I mean is that I would never try to mix five different Ruby versions and expect that to be a good practice. Someone educate me -- I'm not entirely sold on what's happening or why it's considered good.
Why use ES6? Firstly, it's a much better version, it solves a lot of problems (chief of all, it has a module system which ES5 doesn't have, not built in at least). Second, JS technology moves incredibly fast. ES6 will likely be supported 100% before the end of next year in all major browsers. So by then you can drop babel and just have raw code. Same with node.
It was supposed to be fully implemented end of this year or thereabout, but it seems that implementing the module system is problematic. Sadly, it's the most important thing, without which you can't drop babel.
So, the choices are either only use features once you _know_ that a large enough percentage of your target audience supports it, or transpile newer syntax into older, more widely compatible syntax.