3 ms·
The problem isn't the .mjs extension, but the unfortunate ability to import CommonJS modules, when that can already be done via require(). Dependency edges out
by spankalee 9y ago
The problem isn't the .mjs extension, but the unfortunate ability to import CommonJS modules, when that can already be done via require().
Dependency edges out of module land should be explicit, because those aren't going to work on the web, and the web matters more than node.
- styfle 9y agoI asked about the import syntax[0] and got an answer on GitHub. [0]: https://github.com/nodejs/node/pull/14369#issuecomment-329034997 https://github.com/nodejs/node/pull/14369#issuecomment-32903...
- likeclockwork 9y agoI think this decision is also short-sighted since ES Modules are now JS and CommonJS should be phased out over time, but now CommonJS is the default and holds the .js extension just complicating everything for short-term ease of use. They should have left requiring for CJS modules and let things be crappy for a while as requires and CJS are phased out. Eventually only ESM would remain except for in some abandoned packages, which could still be required. But now CJS is going to live forever because it's the default and ESM is opt in.