MCPcopy
hub / github.com/webpack/webpack / readResource

Method readResource

lib/NormalModule.js:1570–1592  ·  lib/NormalModule.js::NormalModule.readResource
(resourcePath, getLoaderContext)

Source from the content-addressed store, hash-verified

1568 processResource: async (loaderContext, resourcePath, callback) => {
1569 /** @type {ReadResource} */
1570 const readResource = (resourcePath, getLoaderContext) => {
1571 const scheme = getScheme(resourcePath);
1572 return new Promise((resolve, reject) => {
1573 hooks.readResource
1574 .for(scheme)
1575 .callAsync(getLoaderContext(resourcePath), (err, result) => {
1576 if (err) {
1577 reject(err);
1578 } else {
1579 if (typeof result !== class="st">"string" && !result) {
1580 return reject(
1581 new UnhandledSchemeError(
1582 /** @type {string} */
1583 (scheme),
1584 resourcePath
1585 )
1586 );
1587 }
1588 resolve(result);
1589 }
1590 });
1591 });
1592 };
1593 try {
1594 const result = await readResource(
1595 resourcePath,

Callers

nothing calls this directly

Calls 2

getSchemeFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected