-
Notifications
You must be signed in to change notification settings - Fork 303
Description
- Node.js Version: 12.14.1
- OS: Win 10 1909 build 18363
- Scope (install, code, runtime, meta, other?): runtime
- Module (and version) (if relevant): es6
I am trying to use ES6 modules feature.
I checked on node.green that node 12 supports ES2019 100%
Why do I still have to use type: module and --experimental-modules tweaks?
Anyhow, I enable those configs.
I have two files in current directory along with a package.json file.
main.js
import { a } from './somemodule.js';
console.log(a);
somemodule.js
export const a = 10;
Above files are in the same directory from where I am running this command.
node --experimental-modules main.js
But still getting below error.
(node:1164) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/esm/default_resolve.js:84
let url = moduleWrapResolve(specifier, parentURL);
^Error: Cannot find module C:\Users\sujee\Desktop\import\j imported from C:\Users\sujee\Desktop\import\b.js
at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:84:13)
at Loader.resolve (internal/modules/esm/loader.js:73:33)
at Loader.getModuleJob (internal/modules/esm/loader.js:147:40)
at ModuleWrap. (internal/modules/esm/module_job.js:41:40)
at link (internal/modules/esm/module_job.js:40:36) {