9 ms·
Can someone explain to me the migration path towards ES6 and syntax like this? This isn't syntactically valid ES5, so is there a reasonable path to making the b
by phleet 12y ago
Can someone explain to me the migration path towards ES6 and syntax like this? This isn't syntactically valid ES5, so is there a reasonable path to making the browsers run ES6 directly?
If I just include it in a <script> tag directly, it'll throw syntax errors in any non-es6 compliant browser. So I'd have the transpile, and send down the es5 version of the code.
But if I'm transpiling, what's the point? I still have a build step, so why use ES6 over another compile-to-js language? The eventual promise, that years and years and years from now, all the non-es6 compliant browser will be dead, so I can send down the es6 code directly?
- ripter 12y agoscript supports a new type, module. <script type="module"> // loads the 'q' export from 'mymodule.js' in the same path as the page import { q } from 'mymodule'; new q(); // -> 'this is an es6 class!' </script> You can use it today with things like : https://github.com/ModuleLoader/es6-module-loader https://github.com/ModuleLoader/es6-module-loader