-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
34 lines (31 loc) · 1.12 KB
/
Copy pathnext.config.ts
File metadata and controls
34 lines (31 loc) · 1.12 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
30
31
32
33
34
import type { NextConfig } from "next";
import { withSentryConfig } from "@sentry/nextjs";
const nextConfig: NextConfig = {
serverExternalPackages: ["pg"],
images: {
remotePatterns: [
{ hostname: "lh3.googleusercontent.com" },
{ hostname: "*.public.blob.vercel-storage.com" },
],
},
async headers() {
return [
{ source: "/preview/:path*", headers: [{ key: "X-Robots-Tag", value: "noindex, nofollow" }] },
];
},
};
// 仅当配置了上传凭据时才套 Sentry 构建包装(上传 source map、注入 release)。
// 未配置(如 CI / 本地无密钥)时导出原配置:构建干净、不触发被忽略的 @sentry/cli,
// 运行时错误捕获仍由 sentry.*.config.ts 按 DSN 生效,互不影响。
const sentryEnabled = Boolean(
process.env.SENTRY_AUTH_TOKEN && process.env.SENTRY_ORG && process.env.SENTRY_PROJECT,
);
export default sentryEnabled
? withSentryConfig(nextConfig, {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
silent: !process.env.CI,
widenClientFileUpload: true,
disableLogger: true,
})
: nextConfig;