The latest versions of Node do support most of the ES6 syntax. However, notably, they still do not support import
and export
expressions. In order to use these espressions we can turn to Babel.
Babel provides a wrapper around Node that automatically translates a given source file before running it in the normal
Node application installed on your machine. This wrapper application is called babel-node
and is provided in the
babel-cli
package.
However, import
and export
translators are not in the core Babel functionality, we'll need to add a preset.
The translators needed here are in the es2015
Babel preset.