perf: Remove dynamic imports of Sentry (#20545)

This commit is contained in:
Keith Williams authored and GitHub committed 2025-04-04 13:22:27 +00:00
1 parent ddde762f9b
commit 3d583678cf
6 files changed
+10 -11

No files matched your search

@@ -1,4 +1,5 @@
import { wrapApiHandlerWithSentry } from "@sentry/nextjs";
import { captureException } from "@sentry/nextjs";
import type { Params } from "app/_types";
import { ApiError } from "next/dist/server/api-utils";
import type { NextRequest } from "next/server";
@@ -48,7 +49,6 @@ export const defaultResponderForAppDir = <T extends NextResponse | Response = Ne
// Don't report 400-499 errors to Sentry/console
if (!(serverError.statusCode >= 400 && serverError.statusCode < 500)) {
console.error(serverError);
const captureException = (await import("@sentry/nextjs")).captureException;
captureException(error);
}