It seems to be becoming fairly common practice to generate two versions of an application’s JavaScript bundle: one that retains most of the features and syntax of modern JavaScript, and a second that compiles down to pure ES5 for maximum compatibility. There’s a slightly hacky but ultimately quite simple way to make sure the right bundle flavor is loaded, by using <script type="module"> and nomodule respectively.
We should explore setting things up this way in Popcode. I think it would mostly be worth the extra complexity if the modern JS bundle were substantially smaller than the legacy bundle, so worth investigating that first.
Another potential argument would be if modern browsers were able to execute modern ES meaningfully more efficiently—I have not seen any benchmarks one way or another but it seems intuitively possible.
It seems to be becoming fairly common practice to generate two versions of an application’s JavaScript bundle: one that retains most of the features and syntax of modern JavaScript, and a second that compiles down to pure ES5 for maximum compatibility. There’s a slightly hacky but ultimately quite simple way to make sure the right bundle flavor is loaded, by using
<script type="module">
andnomodule
respectively.We should explore setting things up this way in Popcode. I think it would mostly be worth the extra complexity if the modern JS bundle were substantially smaller than the legacy bundle, so worth investigating that first.