MCPcopy
hub / github.com/webpack/webpack / moduleRaw

Method moduleRaw

lib/RuntimeTemplate.js:672–704  ·  view source on GitHub ↗

* Returns the expression. * @param {object} options options object * @param {Module | null} 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 i

({ module, chunkGraph, request, weak, runtimeRequirements })

Source from the content-addressed store, hash-verified

670 * @returns {string} the expression
671 */
672 moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }) {
673 if (!module) {
674 return this.missingModule({
675 request
676 });
677 }
678 const moduleId = chunkGraph.getModuleId(module);
679 if (moduleId === null) {
680 if (weak) {
681 // only weak referenced modules don't get an id
682 // we can always emit an error emitting code here
683 return this.weakError({
684 module,
685 chunkGraph,
686 request,
687 type: "expression"
688 });
689 }
690 throw new Error(
691 `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage(
692 module,
693 chunkGraph
694 )}`
695 );
696 }
697 runtimeRequirements.add(RuntimeGlobals.require);
698 return `${RuntimeGlobals.require}(${this.moduleId({
699 module,
700 chunkGraph,
701 request,
702 weak
703 })})`;
704 }
705
706 /**
707 * Returns the expression.

Callers 8

moduleExportsMethod · 0.95
moduleNamespaceMethod · 0.95
asyncModuleFactoryMethod · 0.95
syncModuleFactoryMethod · 0.95
codeGenerationMethod · 0.80
applyMethod · 0.80
applyMethod · 0.80

Calls 6

missingModuleMethod · 0.95
weakErrorMethod · 0.95
moduleIdMethod · 0.95
noModuleIdErrorMessageFunction · 0.85
getModuleIdMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected