MCPcopy
hub / github.com/webpack/webpack / moduleId

Method moduleId

lib/RuntimeTemplate.js:641–660  ·  view source on GitHub ↗

* Returns the expression. * @param {object} options options object * @param {Module} options.module the module * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {string=} options.request the request that should be printed as comment * @param {boolean=} options.weak if the d

({ module, chunkGraph, request, weak })

Source from the content-addressed store, hash-verified

639 * @returns {string} the expression
640 */
641 moduleId({ module, chunkGraph, request, weak }) {
642 if (!module) {
643 return this.missingModule({
644 request
645 });
646 }
647 const moduleId = chunkGraph.getModuleId(module);
648 if (moduleId === null) {
649 if (weak) {
650 return "null /* weak dependency, without id */";
651 }
652 throw new Error(
653 `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage(
654 module,
655 chunkGraph
656 )}`
657 );
658 }
659 return `${this.comment({ request })}${JSON.stringify(moduleId)}`;
660 }
661
662 /**
663 * Returns the expression.

Callers 6

moduleRawMethod · 0.95
moduleNamespaceMethod · 0.95
importStatementMethod · 0.95
applyMethod · 0.80
applyMethod · 0.80

Calls 4

missingModuleMethod · 0.95
commentMethod · 0.95
noModuleIdErrorMessageFunction · 0.85
getModuleIdMethod · 0.80

Tested by

no test coverage detected