Home / Function/ main() — react Function Reference

main() — react Function Reference

Architecture documentation for the main() function in build.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  b8a74eb6_bc15_fef1_125a_c2ace8297b67["main()"]
  67a0a2e0_bd49_0c73_8f90_c9d35aa3cb60["build.js"]
  b8a74eb6_bc15_fef1_125a_c2ace8297b67 -->|defined in| 67a0a2e0_bd49_0c73_8f90_c9d35aa3cb60
  719afe7b_9c41_c553_ebc8_a674272e75ad["ensureLocalBuild()"]
  b8a74eb6_bc15_fef1_125a_c2ace8297b67 -->|calls| 719afe7b_9c41_c553_ebc8_a674272e75ad
  2c6ee3a2_327d_ea10_b3a5_7f84525f97d2["preProcess()"]
  b8a74eb6_bc15_fef1_125a_c2ace8297b67 -->|calls| 2c6ee3a2_327d_ea10_b3a5_7f84525f97d2
  85bfd344_88f5_a361_4b0a_f3114381e9ca["build()"]
  b8a74eb6_bc15_fef1_125a_c2ace8297b67 -->|calls| 85bfd344_88f5_a361_4b0a_f3114381e9ca
  abc03ef7_2a84_bb24_7242_3af05545235d["postProcess()"]
  b8a74eb6_bc15_fef1_125a_c2ace8297b67 -->|calls| abc03ef7_2a84_bb24_7242_3af05545235d
  style b8a74eb6_bc15_fef1_125a_c2ace8297b67 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-extensions/build.js lines 157–196

const main = async buildId => {
  if (!SUPPORTED_BUILDS.includes(buildId)) {
    throw new Error(
      `Unexpected build id - "${buildId}". Use one of ${JSON.stringify(
        SUPPORTED_BUILDS,
      )}.`,
    );
  }

  const root = join(__dirname, buildId);
  const manifestPath = join(root, 'manifest.json');
  const destinationPath = join(root, 'build');

  const envExtension = {
    IS_CHROME: buildId === 'chrome',
    IS_FIREFOX: buildId === 'firefox',
    IS_EDGE: buildId === 'edge',
  };

  try {
    const tempPath = join(__dirname, 'build', buildId);
    await ensureLocalBuild();
    await preProcess(destinationPath, tempPath);
    const webpackStatsFilePath = await build(
      tempPath,
      manifestPath,
      envExtension,
    );

    const builtUnpackedPath = join(destinationPath, 'unpacked');
    await postProcess(tempPath, destinationPath, webpackStatsFilePath);

    return builtUnpackedPath;
  } catch (error) {
    console.error(error);
    process.exit(1);
  }

  return null;
};

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the react codebase, defined in packages/react-devtools-extensions/build.js.
Where is main() defined?
main() is defined in packages/react-devtools-extensions/build.js at line 157.
What does main() call?
main() calls 4 function(s): build, ensureLocalBuild, postProcess, preProcess.

Analyze Your Own Codebase

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

Try Supermodel Free