refactor: remove obsolete config and cross-layer exports

Drop the temporary static-generation retry override and stale hydration suppression. Refresh outdated Next.js and migration comments, and stop re-exporting Result through the storage layer.
This commit is contained in:
2026-07-13 18:45:59 +08:00
parent f7f910bd61
commit 4083cf0b6c
11 changed files with 31 additions and 118 deletions
+16 -57
View File
@@ -2,21 +2,9 @@ import { withSentryConfig } from "@sentry/nextjs";
import type { NextConfig } from "next";
import { withSerwist } from "@serwist/turbopack";
/**
* Next.js 16 临时绕过 `/_global-error` prerender 的 workStore bug
* 标记根 layout 不参与静态预渲染(global-error 会在请求时渲染)
* https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
*
* 容器化部署模型:`output: "standalone"` + Docker Compose。
* - `pnpm build` 产出 .next/standalone、.next/static、public。
* - Dockerfile 运行 `node server.js`,仅复制 standalone traced runtime 依赖。
*/
const nextConfig: NextConfig = {
// Docker runs the traced runtime emitted to `.next/standalone`.
output: "standalone",
experimental: {
// 关闭静态优化以规避 16.2.7 global-error prerender bug
staticGenerationRetryCount: 0,
},
images: {
remotePatterns: [
{
@@ -44,48 +32,19 @@ const shouldUploadSentrySourcemaps =
process.env.CI !== "true" || process.env.SENTRY_UPLOAD_SOURCEMAPS === "1";
export default withSentryConfig(withSerwist(nextConfig), {
// For all available options, see:
// https://www.npmjs.com/package/@sentry/webpack-plugin#options
org: "shenzhen-banlv-zhidao-technolo",
project: "javascript-nextjs",
// Only print logs for uploading source maps in CI
silent: !process.env.CI,
// Keep build metadata local; application errors/performance are configured separately.
telemetry: false,
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// PR/branch CI should validate builds without uploading source maps. Release jobs can
// set SENTRY_UPLOAD_SOURCEMAPS=1 to enable uploads explicitly.
sourcemaps: {
disable: !shouldUploadSentrySourcemaps,
},
// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
// tunnelRoute: "/monitoring",
webpack: {
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
// Tree-shaking options for reducing bundle size
treeshake: {
// Automatically tree-shake Sentry logger statements to reduce bundle size
removeDebugLogging: true,
},
},
org: "shenzhen-banlv-zhidao-technolo",
project: "javascript-nextjs",
silent: !process.env.CI,
telemetry: false,
widenClientFileUpload: true,
// Validation builds keep source maps local; release jobs opt in to upload.
sourcemaps: {
disable: !shouldUploadSentrySourcemaps,
},
webpack: {
automaticVercelMonitors: true,
treeshake: {
removeDebugLogging: true,
},
},
});