-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Closed
Closed
Copy link
Labels
vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Description
- Version: v12.16.3
- Platform: macOS
- Subsystem: ESM
What steps will reproduce the bug?
// file.js
import('fs')
.then(() => {
console.log('yay!');
})
.catch(error => {
console.error('aww', error);
process.exitCode = 1;
});
Node 12 still has flagged ESM, so running this file results in the following:
$ node file.js
aww Error: Not supported
at Object.<anonymous> (/Users/simen/oops/file.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
However, if you add --experimental-vm-modules
, the error gets very confusing.
$ node --experimental-vm-modules file.js
aww TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified.
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:35:9)
at Object.<anonymous> (/Users/simen/oops/file.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING'
}
How often does it reproduce? Is there a required condition?
It always reproduces
What is the expected behavior?
Node should give the same warning as if the flag wasn't passed.
What do you see instead?
Node throws ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING
instead.
Additional information
N/A
Metadata
Metadata
Assignees
Labels
vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.