Use of reserved word "import" in javascript

1

Reading the Ghost code, CMS platform based on NodeJS 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've 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 any external library or is it because of an already active feature that makes ES6 possible?

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

    
asked by anonymous 21.07.2015 / 19:29

1 answer

1

ES6 is no longer experimental, 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 biggest transpilers in existence today are Babel (formerly called 6to5) and traceur (by Google). I prefer Babel, since it already has 73% of the "transpilable" features.

You can see the ES6 compat-table: link

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

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

As for "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 System.JS

    
05.08.2015 / 16:59