popcode icon indicating copy to clipboard operation
popcode copied to clipboard

Load modern ES bundle in modern browsers

Open outoftime opened this issue 7 years ago • 1 comments

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.

outoftime avatar Dec 03 '18 11:12 outoftime

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.

outoftime avatar Dec 03 '18 12:12 outoftime