MCPcopy
hub / github.com/webpack/webpack / renderModuleContent

Method renderModuleContent

lib/library/ModuleLibraryPlugin.js:550–567  ·  view source on GitHub ↗

* Renders module content. * @param {Source} source source * @param {Module} module module * @param {ModuleRenderContext} renderContext render context * @param {Omit<LibraryContext<T>, "options">} libraryContext context * @returns {Source} source with library export

(
		source,
		module,
		{ factory, inlinedInIIFE, chunk },
		libraryContext
	)

Source from the content-addressed store, hash-verified

548 * @returns {Source} source with library export
549 */
550 renderModuleContent(
551 source,
552 module,
553 { factory, inlinedInIIFE, chunk },
554 libraryContext
555 ) {
556 const exportsSource =
557 module.buildMeta &&
558 module.buildMeta.exportsSourceByRuntime &&
559 module.buildMeta.exportsSourceByRuntime.get(getRuntimeKey(chunk.runtime));
560
561 // Re-add the module's exports source when rendered in factory
562 // or as an inlined startup module wrapped in an IIFE
563 if ((inlinedInIIFE || factory) && exportsSource) {
564 return new ConcatSource(exportsSource, source);
565 }
566 return source;
567 }
568}
569
570module.exports = ModuleLibraryPlugin;

Callers

nothing calls this directly

Calls 2

getRuntimeKeyFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected