package.json

1
2
3
4
5
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5"
}

.babelrc

1
2
3
{
"presets": ["@babel/preset-env"]
}

entry point node.js app

1
2
3
4
require("@babel/register")({})

// Import the rest of our application.
module.exports = require('./index.js')

Link How To Enable ES6 Imports in Node.JS https://timonweb.com/posts/how-to-enable-es6-imports-in-nodejs/