I'm getting the following error trying us the es6 import syntax inside the node console.
import Dog from './lib/Dog.js';
Thrown:
import Dog from './lib/Dog.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
I'm initiating the console as follows:
$ node --experimental-modules
Welcome to Node.js v12.13.0.
Type ".help" for more information.
> (node:81053) ExperimentalWarning: The ESM module loader is experimental.
You can see that I'm running node 12.13 and using the --experimental-modules flag.
My package.json also includes {"type": "module"}
but for some reason it still won't let me use the import syntax.
Any ideas are much appreciated.