3 ms·
Short of browser useragent sniffing (yuck...) is there any way to make use of ES6 features in a browser agnostic app? Seems like the only way to work is with a
by koolba 11y ago
Short of browser useragent sniffing (yuck...) is there any way to make use of ES6 features in a browser agnostic app? Seems like the only way to work is with a transpiler and series of polyfills.
- deleted 11y ago[deleted]
- Spivak 11y agoYou could do something like try { eval('"use strict"; import "jquery";'); } catch (e) { // No imports. } but I wouldn't really recommend it.
- MatthewPhillips 11y agoThat won't work, you can't eval modules.
- wavefunction 11y agoDepending on the ES6 features and your supported browsers, you don't need anything. If you want to use all the ES6 features, no single modern browser implements them all (Webkit is still lacking on modules) and so you will need to use a collection of polyfills.
- 33degrees 11y agoGiven that transpilers give better performance at the moment, there's not much reason to use ES6 features natively for now.