Search code examples
javascriptecmascript-6es6-module-loader

es6 modules native support


I understand the ES6 modules specification, the question is about its support. AFAIK, there are no browsers that implement this natively (see Browser compatibility here). Got a couple of questions about this:

  • ES6 modules is an ES6 feature, obviously. When I look at kangax compatibility table, I don't see such row (for ES6 modules) at all, why is that? It's a ES6 feature afterall...
  • hence, the only way to use ES6 right now is to use a build tool, such as babel, browserify or any other aternative, right?
  • how are the modules gonna be fetched, when they're natively supported - as async AJAX calls from the browser?

Solution

  • ES6 modules is an ES6 feature, obviously. When I look at kangax compatibility table, I don't see such row (for ES6 modules) at all, why is that?

    There's an issue being discussed on kangax's github.

    the only way to use ES6 right now is to use a build tool, such as babel, browserify or any other aternative, right?

    No. There is also a polyfill by Guy Bedford at http://github.com/ModuleLoader/browser-es-module-loader.

    And there's already the preview release of Edge that implements it natively.

    how are the modules gonna be fetched, when they're natively supported - as async AJAX calls from the browser?

    Yes but not exactly: they will be fetched when the are used for the first time, by a call to an object (a function or a property) on the imported library.