-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Closed
Copy link
Labels
cliIssues and PRs related to the Node.js command line interface.Issues and PRs related to the Node.js command line interface.esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.
Description
- Version: v8.8.0
- Platform: macOS
- Subsystem: ES Modules
Assuming the simple file main.mjs:
console.log('hi')Running node --experimental-modules main.mjs will work, but node --experimental-modules main won't work. You get:
{ Error: Cannot find module file:///********/main
at module.exports (internal/loader/search.js:14:12)
at exports.resolve (internal/loader/ModuleRequest.js:93:11)
at Loader.resolve (internal/loader/Loader.js:51:40)
at Loader.getModuleJob (internal/loader/Loader.js:79:40)
at Loader.import (internal/loader/Loader.js:101:28)
at module.js:454:29
at Function.Module._load (module.js:455:7)
at Function.Module.runMain (module.js:653:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3 code: 'MODULE_NOT_FOUND' }
This is true even if the extension of the file is js.
This is a regression - it works fine in v8.7.
If it's a feature and not a bug, then it doesn't make sense to me, as importing the same file without an extension works fine - and I believe running a file in the command line and importing it should have similar semantics.
Metadata
Metadata
Assignees
Labels
cliIssues and PRs related to the Node.js command line interface.Issues and PRs related to the Node.js command line interface.esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.