def build(
    deploy_url: str | None = None,
    for_export: bool = False,
):
    """Build the app for deployment.

    Args:
        deploy_url: The deployment URL.
        for_export: Whether the build is for export.
    """
    wdir = prerequisites.get_web_dir()

    # Clean the static directory if it exists.
    path_ops.rm(str(wdir / constants.Dirs.STATIC))

    # The export command to run.
    command = "export"

    checkpoints = [
        "Linting and checking ",
        "Creating an optimized production build",
        "Route (pages)",
        "prerendered as static HTML",
        "Collecting page data",
        "Finalizing page optimization",
        "Collecting build traces",
    ]

    # Generate a sitemap if a deploy URL is provided.
    if deploy_url is not None:
        generate_sitemap_config(deploy_url, export=for_export)
        command = "export-sitemap"

        checkpoints.extend(["Loading next-sitemap", "Generation completed"])

    # Start the subprocess with the progress bar.
    process = processes.new_process(
        [*prerequisites.get_js_package_executor(raise_on_none=True)[0], "run", command],
        cwd=wdir,
        shell=constants.IS_WINDOWS,
    )
    processes.show_progress("Creating Production Build", process, checkpoints)
Build the app for deployment.

    Args:
        deploy_url: The deployment URL.
        for_export: Whether the build is for export.
    
reflex/utils/build.py