MCPcopy
hub / github.com/webpack/webpack / generateContentCode

Method generateContentCode

lib/css/CssGenerator.js:315–347  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

313 .isCssModule;
314
315 const generateContentCode = () => {
316 switch (exportType) {
317 case "style": {
318 const cssSource = this._renderCss(module, generateContext);
319 if (!cssSource) return "";
320
321 generateContext.runtimeRequirements.add(
322 RuntimeGlobals.cssInjectStyle
323 );
324
325 const moduleId = generateContext.chunkGraph.getModuleId(module);
326
327 if (generateContext.concatenationScope) {
328 return new ConcatSource(
329 `__webpack_css_styles__.push([${JSON.stringify(moduleId)}, `,
330 this._cssToJsLiteral(cssSource, devtool, generateContext),
331 "]);"
332 );
333 }
334
335 return new ConcatSource(
336 `${RuntimeGlobals.cssInjectStyle}(${JSON.stringify(
337 moduleId
338 )}, `,
339 this._cssToJsLiteral(cssSource, devtool, generateContext),
340 ");"
341 );
342 }
343
344 default:
345 return "";
346 }
347 };
348 const generateImportCode = () => {
349 switch (exportType) {
350 case "style": {

Callers

nothing calls this directly

Calls 4

_renderCssMethod · 0.95
_cssToJsLiteralMethod · 0.95
getModuleIdMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected