We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a8f2e7f commit 75f2e05Copy full SHA for 75f2e05
lib/internal/modules/esm/loader.js
@@ -23,6 +23,7 @@ const {
23
const { MessageChannel } = require('internal/worker/io');
24
25
const {
26
+ ERR_INTERNAL_ASSERTION,
27
ERR_INVALID_ARG_TYPE,
28
ERR_INVALID_ARG_VALUE,
29
ERR_INVALID_RETURN_PROPERTY_VALUE,
@@ -260,6 +261,10 @@ class ESMLoader {
260
261
// fetchModule's cache, in which case, fetchModule returns
262
// immediately and synchronously
263
url = fetchModule(new URL(url), { parentURL: url }).resolvedHREF;
264
+ // This should only occur if the module hasn't been fetched yet
265
+ if (typeof url !== 'string') {
266
+ throw new ERR_INTERNAL_ASSERTION(`Base url for module ${url} not loaded.`);
267
+ }
268
}
269
return url;
270
0 commit comments