MCPcopy
hub / github.com/webpack/webpack / getContent

Method getContent

lib/ConditionalInitFragment.js:70–81  ·  view source on GitHub ↗

* Returns the source code that will be included as initialization code. * @param {GenerateContext} context context * @returns {string | Source | undefined} the source code that will be included as initialization code

(context)

Source from the content-addressed store, hash-verified

68 * @returns {string | Source | undefined} the source code that will be included as initialization code
69 */
70 getContent(context) {
71 if (this.runtimeCondition === false || !this.content) return "";
72 if (this.runtimeCondition === true) return this.content;
73 const expr = context.runtimeTemplate.runtimeConditionExpression({
74 chunkGraph: context.chunkGraph,
75 runtimeRequirements: context.runtimeRequirements,
76 runtime: context.runtime,
77 runtimeCondition: this.runtimeCondition
78 });
79 if (expr === "true") return this.content;
80 return wrapInCondition(expr, this.content);
81 }
82
83 /**
84 * Returns the source code that will be included at the end of the module.

Callers

nothing calls this directly

Calls 2

wrapInConditionFunction · 0.85

Tested by

no test coverage detected