4 ms·
Indeed. Are there any 'good' strategies for this (loading ES6 for supported browsers)? I imagine you'd have to do UA sniffing on the server side, and I suppose
by jaquers 10y ago
Indeed. Are there any 'good' strategies for this (loading ES6 for supported browsers)? I imagine you'd have to do UA sniffing on the server side, and I suppose it's kind of a moot point if you're using React/JSX.
- Tankenstein 10y agoThere's no need unless you need runtime-only concepts, like new string methods. Use https://babeljs.io/ https://babeljs.io/ to turn nice es6 into es5. (I imagine you already know this, if you're using react/jsx)
- megous 10y agoJust try to eval a sample of ES6 syntax you use, and if it throws error, load ES5 code. You'd need to feature check all the features that you use, to cover the browser versions with incomplete ES6 support.
- hzoo 10y agoWorking on https://github.com/babel/babel-preset-env https://github.com/babel/babel-preset-env right now which should help with this