3 ms·
I'm not really into web/frontend stuff. I'm interested, but it's not part of my day job and so I dabble only, play a bit here and there. My last experiments ca
by darklajid 11y ago
I'm not really into web/frontend stuff. I'm interested, but it's not part of my day job and so I dabble only, play a bit here and there.
My last experiments caused lots of browser based problems (string.prototype.contains doesn't exist in IE9 etc..) and ES6 features were a no-go for the same reason. How do you actually use things like the fat arrow etc. in applications today?
Is that limited to server-side code for now (and for quite some time..)? Do you decide to ignore a number of ~relevant~ browsers? Build tools to generate a 'lower' dialect/subset?
Any intro to this specific topic, i.e. 'making sure your ~modern~ code works in last years browsers'?
- Skinney 11y agoA lot of people use transpilers like Babel or Traceur. They compile ES6 to ES5 (or lower) for use in older browsers.
- tracker1 11y agoI use BabelJs (formerly 6to5), and Traceur before that, which transpile/morph your ES6/7 code into something usable with older browsers... Since it will probably be 5+ years until I can actually rely on async/await sugar to be native and not have to worry about legacy browsers, I don't think this is going away any time soon. I actually do a lot ov server-side code in JS (via node/io.js) as well, so the build step isn't so bad.... breaking your code up into separate modules that build separately is a good idea though, so your build times aren't too much.
- joshuacc 11y agoFor runtime features like String.prototype.contains you can use a polyfill library like es6-shim[1]. For new syntax, you can use a compiler like Babel[2]. [1] https://github.com/paulmillr/es6-shim/ https://github.com/paulmillr/es6-shim/ [2] https://babeljs.io/ https://babeljs.io/
- lobster_johnson 11y agoBabel comes with Core.js [1] built in, which is (I believe) a better and more exhaustive shim library than es6-shim and the others. [1] https://github.com/zloirock/core-js https://github.com/zloirock/core-js
- Lazare 11y agoModern frontend development seems to be stabilizing on using either browserify or webpack to pull modules together, along with some transpiler such as babel (for es6), coffeescript, or typescript. It's a bit of work to get a project up and running from scratch, but there's plenty of templates, and the result is nice.