Files
Dramlog-Prod/next.config.mjs
robin 004698b604 feat: Enable React Compiler for automatic memoization
- Install babel-plugin-react-compiler@1.0.0
- Add reactCompiler: true to next.config.mjs
- React 19 compiler will auto-optimize useMemo/useCallback
2026-01-19 22:47:01 +01:00

47 lines
1.3 KiB
JavaScript

import { withSentryConfig } from "@sentry/nextjs";
/** @type {import('next').Config} */
const nextConfig = {
output: 'standalone',
// Enable source maps for Sentry stack traces in production
productionBrowserSourceMaps: !!process.env.GLITCHTIP_DSN,
// React Compiler for automatic memoization (React 19+)
reactCompiler: true,
experimental: {
serverActions: {
bodySizeLimit: '10mb',
},
},
};
// Wrap with Sentry only if DSN is configured
const sentryEnabled = !!process.env.GLITCHTIP_DSN || !!process.env.NEXT_PUBLIC_GLITCHTIP_DSN;
const sentryWebpackPluginOptions = {
// Suppresses source map uploading logs during build
silent: true,
// Organization and project slugs (optional - for source map upload)
org: process.env.GLITCHTIP_ORG,
project: process.env.GLITCHTIP_PROJECT,
// GlitchTip server URL
sentryUrl: process.env.GLITCHTIP_URL,
// Auth token for source map upload
authToken: process.env.GLITCHTIP_AUTH_TOKEN,
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements
disableLogger: true,
// Prevent bundling of native binaries
widenClientFileUpload: true,
};
export default sentryEnabled
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
: nextConfig;