forked from FlowwStar/FlowStar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
29 lines (25 loc) · 1.02 KB
/
Copy pathnext.config.mjs
File metadata and controls
29 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { withSentryConfig } from '@sentry/nextjs'
/** @type {import('next').NextConfig} */
const nextConfig = {}
// Bundle analyzer — run with: ANALYZE=true npm run build
async function withBundleAnalyzer(config) {
if (process.env.ANALYZE !== 'true') return config
try {
const { default: analyzer } = await import('@next/bundle-analyzer')
return analyzer({ enabled: true })(config)
} catch {
console.warn('[FlowStar] @next/bundle-analyzer not installed — skipping analysis')
return config
}
}
const analyzedConfig = await withBundleAnalyzer(nextConfig)
export default withSentryConfig(analyzedConfig, {
// Sentry org/project set via env vars: SENTRY_ORG, SENTRY_PROJECT, SENTRY_AUTH_TOKEN.
silent: true,
// Upload source maps only in CI to avoid leaking local paths.
disableSourceMapUpload: process.env.CI !== 'true',
// Automatically instrument Next.js server routes.
autoInstrumentServerFunctions: true,
// Tree-shake unused Sentry features to keep bundle small.
widenClientFileUpload: false,
})