You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
I expected that many users will be confused by .mjs and ESM.
Here's an example:
root
├── a.js
Details
export const a = 1;
└── index.mjs
Details
import {a} from "./a.js"
console.log(a);
When running this with node --experimental-modules index.mjs, the error is the following:
(node:9967) ExperimentalWarning: The ESM module loader is experimental.
file:////test/index.mjs:1
import {a} from "./a.js"
^
SyntaxError: The requested module './a.js' does not provide an export named 'a'
at ModuleJob._instantiate (internal/modules/esm/module_job.js:89:21)
While importing ./a.js is not an error (since CJS interop), it's clear that the user intended to use ESM. It would make sense to warn the user.
Note that .js/.mjs is not clear in tooling yet (Babel), so it could end up being generated.
I expected that many users will be confused by
.mjsand ESM.Here's an example:
When running this with
node --experimental-modules index.mjs, the error is the following:While importing
./a.jsis not an error (since CJS interop), it's clear that the user intended to use ESM. It would make sense to warn the user.Note that
.js/.mjsis not clear in tooling yet (Babel), so it could end up being generated.(node v10.4.1)