Skip to content
index.tsx 935 B
Newer Older
Grant's avatar
Grant committed
import React from "react";
import { createRoot } from "react-dom/client";
Grant's avatar
Grant committed
import { NextUIProvider } from "@nextui-org/react";
Grant's avatar
Grant committed
import App from "./components/App";

Grant's avatar
Grant committed
import Bugsnag from "@bugsnag/js";
import BugsnagPluginReact from "@bugsnag/plugin-react";
import BugsnagPerformance from "@bugsnag/browser-performance";

Grant's avatar
Grant committed
let ErrorBoundary: any = ({ children }: React.PropsWithChildren) => (
  <>{children}</>
);
Grant's avatar
Grant committed

if (import.meta.env.VITE_BUGSNAG_KEY) {
  Bugsnag.start({
    apiKey: import.meta.env.VITE_BUGSNAG_KEY,
    plugins: [new BugsnagPluginReact()],
  });
  BugsnagPerformance.start({ apiKey: import.meta.env.VITE_BUGSNAG_KEY });

  ErrorBoundary = Bugsnag.getPlugin("react")!.createErrorBoundary(React);
}

Grant's avatar
Grant committed
const root = createRoot(document.getElementById("root")!);
Grant's avatar
Grant committed
root.render(
  <React.StrictMode>
Grant's avatar
Grant committed
    <ErrorBoundary>
      <NextUIProvider>
        <App />
      </NextUIProvider>
    </ErrorBoundary>
Grant's avatar
Grant committed
  </React.StrictMode>
);