diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 97a2d5c..be5b7c4 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -1,6 +1,5 @@ import path from "path"; import type { NextConfig } from "next"; -import { withSentryConfig } from "@sentry/nextjs"; const nextConfig: NextConfig = { output: "standalone", @@ -48,10 +47,18 @@ const nextConfig: NextConfig = { // Only wrap with Sentry in production — the worker.js crash in dev mode // (vendor-chunks/lib/worker.js MODULE_NOT_FOUND) makes the dev server unstable -export default process.env.NODE_ENV === "production" - ? withSentryConfig(nextConfig, { +// Sentry only in production — dynamic import avoids side effects in dev +let exportedConfig: NextConfig = nextConfig; +if (process.env.NODE_ENV === "production") { + try { + const { withSentryConfig } = require("@sentry/nextjs"); + exportedConfig = withSentryConfig(nextConfig, { silent: true, sourcemaps: { disable: true }, telemetry: false, - }) - : nextConfig; + }); + } catch { + // Sentry not available — use raw config + } +} +export default exportedConfig;