To use ES6 modules in Node 12, we set the --experimental-modules
option.
For instance, we write
{
"scripts": {
"start": "node --experimental-modules src/index.mjs "
}
}
in package.json to add the start script.
We use it to run node
with the --experimental-modules
on to enable ES6 modules support.