What does that mean for ember now that native ES Modules are enabled by default on all modern browsers?


#1

I have not spent any time trying to understand the nuances of the various module implementations and what ember-cli is doing to make it all work. Please pardon my ignorance! I just read some news that Firefox landed native modules in version 60 which meansall modern browsers support modules natively. I was wondering, if we only need to support modern browsers, can we expect any improvements? Smaller bundles? Faster builds? Are there any tangible advantages?


#2

There’s some brief discussion of how we can start leveraging it in Ember CLI RFC #51.

As that implementation lands and a few other things (I don’t know what they are!) get sorted, we should be able to ship builds that use ES6 modules to modern browsers, with ES5 fallback for IE11 etc. Browsers which don’t support it also just ignore <script type="module"> declarations entirely, so you can safely do this:

<script type="module" src="the-fancy-new-stuff.js">
<script nomodule src="the-old-stuff.js">

This will make it relatively straightforward to ship both modern-ES6+ builds and legacy ES5 builds and consume them appropriately.


#3

Thanks @chriskrycho!