export async function register() {
  // Only load Sentry in production — the worker.js crash in dev mode
  // (vendor-chunks/lib/worker.js MODULE_NOT_FOUND) makes the dev server unstable
  if (process.env.NODE_ENV === "production") {
    if (process.env.NEXT_RUNTIME === "nodejs") {
      await import("../sentry.server.config");
    }
    if (process.env.NEXT_RUNTIME === "edge") {
      await import("../sentry.edge.config");
    }
  }
}

export async function onRequestError(...args: unknown[]) {
  if (process.env.NODE_ENV === "production") {
    const Sentry = await import("@sentry/nextjs");
    (Sentry.captureRequestError as Function)(...args);
  }
}
