diff --git a/lib/internal/modules/esm/module_job.js b/lib/internal/modules/esm/module_job.js index fbb29aef783006..e3fb91ca6ff505 100644 --- a/lib/internal/modules/esm/module_job.js +++ b/lib/internal/modules/esm/module_job.js @@ -6,6 +6,8 @@ const { decorateErrorStack } = require('internal/util'); const assert = require('assert'); const resolvedPromise = SafePromise.resolve(); +function noop() {} + /* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of * its dependencies, over time. */ class ModuleJob { @@ -41,6 +43,9 @@ class ModuleJob { }; // Promise for the list of all dependencyJobs. this.linked = link(); + // This promise is awaited later anyway, so silence + // 'unhandled rejection' warnings. + this.linked.catch(noop); // instantiated == deep dependency jobs wrappers instantiated, // module wrapper instantiated