Hello All,
Anyone tried using the newer ES Modules syntax for nodejs code (using export / import) as opposed to Common JavaScript (using module.exports / require)?
For what it's worth, a simple test results in
***Error***
(node:4531) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.Perhaps it would work with a new prototype question, nodejs_esm say, with main_module.js named main_module.mjs instead?
__tester__.nodejs:2
import done from './cli.mjs');
^^^^^^ SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:931:16)
at Module._compile (internal/modules/cjs/loader.js:979:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
Just trying to keep up...