Home / Function/ main() — react Function Reference

main() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  829ac075_e44f_033f_602f_a410b8aec586["main()"]
  cb6f354e_2376_05bf_7c22_9b78bef9a9fc["build.mjs"]
  829ac075_e44f_033f_602f_a410b8aec586 -->|defined in| cb6f354e_2376_05bf_7c22_9b78bef9a9fc
  style 829ac075_e44f_033f_602f_a410b8aec586 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/react-forgive/scripts/build.mjs lines 30–56

async function main() {
  if (argv.w) {
    const serverCtx = await esbuild.context(Server.config);
    const clientCtx = await esbuild.context(Client.config);
    await Promise.all([serverCtx.watch(), clientCtx.watch()]);
    console.log('watching for changes...');
  } else {
    switch (argv.t) {
      case 'server': {
        await esbuild.build({
          sourcemap: IS_DEV,
          minify: IS_DEV === false,
          ...Server.config,
        });
        break;
      }
      case 'client': {
        await esbuild.build({
          sourcemap: IS_DEV,
          minify: IS_DEV === false,
          ...Client.config,
        });
        break;
      }
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the react codebase, defined in compiler/packages/react-forgive/scripts/build.mjs.
Where is main() defined?
main() is defined in compiler/packages/react-forgive/scripts/build.mjs at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free