3 ms·
> Is it possible to just use ES6 modules natively in the browser if you don't care about older browsers? Yes. Note that you need to use <script type=modul
by codetrotter 9y ago
> Is it possible to just use ES6 modules natively in the browser if you don't care about older browsers?
Yes. Note that you need to use
<script type=module>
Personally though, I am using Google Closure compiler to turn the code of all my ES6 modules into a single, packed file without modules. Additionally I have told Closure compiler to output a sourcemap so that I can debug my code still. There are some issues with this from time to time. Not sure about what the debugging story is like currently with plain ES6 modules in the browser.
Here is my Makefile in case you'd like to look at the arguments I pass to Closure compiler: https://github.com/ctsrc/Infinite-Tower-Run/blob/191a4035fd188c1462979425bb3b8c638ceac438/GNUmakefile https://github.com/ctsrc/Infinite-Tower-Run/blob/191a4035fd1...