MCPcopy
hub / github.com/webpack/webpack / getSourceForEmptyContext

Method getSourceForEmptyContext

lib/ContextModule.js:1248–1258  ·  view source on GitHub ↗

* @param {ModuleId} id module id * @param {RuntimeTemplate} runtimeTemplate runtime template * @returns {string} source for empty async context

(id, runtimeTemplate)

Source from the content-addressed store, hash-verified

1246 * @returns {string} source for empty async context
1247 */
1248 getSourceForEmptyContext(id, runtimeTemplate) {
1249 return `function webpackEmptyContext(req) {
1250 ${runtimeTemplate.renderConst()} e = new Error("Cannot find module '" + req + "'");
1251 e.code = 'MODULE_NOT_FOUND';
1252 throw e;
1253}
1254webpackEmptyContext.keys = ${runtimeTemplate.returningFunction("[]")};
1255webpackEmptyContext.resolve = webpackEmptyContext;
1256webpackEmptyContext.id = ${JSON.stringify(id)};
1257module.exports = webpackEmptyContext;`;
1258 }
1259
1260 /**
1261 * @param {ModuleId} id module id

Callers 1

getSourceStringMethod · 0.95

Calls 2

renderConstMethod · 0.80
returningFunctionMethod · 0.80

Tested by

no test coverage detected