Use of "import" reserved word in javascript

Reading the Code of Ghost, NodeJS-based CMS platform I found a file with the following statement:

import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import 'ghost/utils/link-component';
import 'ghost/utils/text-field';
import config from './config/environment';

Searching the internet I have already found something about being ES6. But it is an application that is being used in production, environment not very favorable to experiments like ES6. Now comes the doubts

Do they use some external library or is it because of some already active feature that allows the use of ES6?

PS: ghost uses Ember with already we can see in this import and the file if you want to consult is this one, code for Ghost on GitHub

Author: flpms, 2015-07-21

1 answers

ES6 is no longer experimental, it has been renamed to ES2015, and has been approved since June.

Most browsers are already implementing the vast majority of their specifications, and there are already very reliable transpilers so that you can already use the vast majority of their features, which will be compiled and translated into Javascript (ES5).

The largest transpilers that exist today are Babel (formerly called 6to5) and traceur (by Google). I prefer the Babel, since it already has 73% of the "transpilable" features.

You can see the COMPAT-table of ES6: http://kangax.github.io/compat-table/es6 /

There are some Javascript frameworks, like Aurelia that have already been made 100% developed in ES6 (and some things from ES7 up, like decorators and declaration of properties outside the constructor).


ES6 is very interesting, and we will probably have all the features implemented in Evergreen Browsers by the end of this year/beginning of next year-so I suggest you start studying it right away.

As for the "import", it is something that has been used for a long time in ES5 through libraries like Require, and nowadays the library that follows the specifications of ES6 is the System.JS

 1
Author: Buzinas, 2015-08-05 14:59:03