Home / Function/ const() — react Function Reference

const() — react Function Reference

Architecture documentation for the const() function in WebpackMock.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  443cdd82_e3b1_40b9_d831_c0b91ba849ff["const()"]
  1afccb37_9b08_bb4a_36b4_9341b4b1f2d3["WebpackMock.js"]
  443cdd82_e3b1_40b9_d831_c0b91ba849ff -->|defined in| 1afccb37_9b08_bb4a_36b4_9341b4b1f2d3
  style 443cdd82_e3b1_40b9_d831_c0b91ba849ff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-server-dom-webpack/src/__tests__/utils/WebpackMock.js lines 196–236

exports.serverExports = function serverExports(moduleExports, blockOnChunk) {
  const idx = '' + webpackModuleIdx++;
  webpackServerModules[idx] = moduleExports;
  const path = url.pathToFileURL(idx).href;

  const chunks = [];
  if (blockOnChunk) {
    const chunkId = webpackChunkIdx++;
    webpackChunkMap[chunkId] = blockOnChunk;
    chunks.push(chunkId);
  }
  webpackServerMap[path] = {
    id: idx,
    chunks: chunks,
    name: '*',
  };
  // We only add this if this test is testing ESM compat.
  if ('__esModule' in moduleExports) {
    webpackServerMap[path + '#'] = {
      id: idx,
      chunks: [],
      name: '',
    };
  }
  if ('split' in moduleExports) {
    // If we're testing module splitting, we encode this name in a separate module id.
    const splitIdx = '' + webpackModuleIdx++;
    webpackServerModules[splitIdx] = {
      s: moduleExports.split,
    };
    webpackServerMap[path + '#split'] = {
      id: splitIdx,
      chunks: [],
      name: 's',
    };
  }
  const mod = new Module();
  mod.exports = moduleExports;
  nodeCompile.call(mod, '"use server"', idx);
  return mod.exports;
};

Domain

Subdomains

Frequently Asked Questions

What does const() do?
const() is a function in the react codebase, defined in packages/react-server-dom-webpack/src/__tests__/utils/WebpackMock.js.
Where is const() defined?
const() is defined in packages/react-server-dom-webpack/src/__tests__/utils/WebpackMock.js at line 196.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free