MCPcopy Index your code
hub / github.com/nodejs/node / defaultImportModuleDynamicallyForScript

Function defaultImportModuleDynamicallyForScript

lib/internal/modules/esm/utils.js:225–229  ·  view source on GitHub ↗

* Proxy the dynamic import to the default loader for classic scripts. * @param {string} specifier - The module specifier string. * @param {number} phase - The module import phase. * @param {Record } attributes - The import attributes object. * @param {string|null|undefined} referr

(specifier, phase, attributes, referrerName)

Source from the content-addressed store, hash-verified

223 * @returns {Promise<import('internal/modules/esm/loader.js').ModuleExports>} - The imported module object.
224 */
225function defaultImportModuleDynamicallyForScript(specifier, phase, attributes, referrerName) {
226 const parentURL = normalizeReferrerURL(referrerName);
227 const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
228 return cascadedLoader.import(specifier, parentURL, attributes, phase);
229}
230
231/**
232 * Loads the built-in and wraps it in a ModuleWrap for embedder ESM.

Callers 1

Calls 3

normalizeReferrerURLFunction · 0.85
importMethod · 0.80
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…