Files
clean-architecture-frontend…/src/bootstrap/main.jsx
T

35 lines
1.1 KiB
React

import { createRoot } from "react-dom/client";
import { BootErrorShell } from "../presentation/boundaries/boot-error-shell.jsx";
import { createRuntimeComposition } from "./create-runtime-composition.js";
import { initializeColorScheme } from "./initialize-color-scheme.js";
import { BootConfigError } from "./load-runtime-config.js";
import { ReleaseManifestError } from "./load-release-manifest.js";
import { RuntimeApplication } from "./runtime-application.jsx";
import "../presentation/styles/theme.css";
const rootElement = document.getElementById("root");
if (!rootElement) {
throw new Error("Missing #root mount element");
}
const root = createRoot(rootElement);
async function boot() {
try {
const composition = await createRuntimeComposition();
initializeColorScheme(composition.application.preferences);
root.render(<RuntimeApplication composition={composition} />);
} catch (error) {
const safe =
error instanceof BootConfigError || error instanceof ReleaseManifestError
? error.safe
: { supportReference: "boot:unknown" };
root.render(<BootErrorShell {...safe} />);
}
}
void boot();