From d101f1582522bff46c711d737a43dfffe3cb246e Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Sun, 21 Jun 2026 21:15:17 +0800 Subject: [PATCH] =?UTF-8?q?=20next.config.ts=20=E9=87=8C=E6=9C=89=20webpac?= =?UTF-8?q?k=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- write-server/.dockerignore | 13 +++++++ write-server/next.config.ts | 67 ++----------------------------------- 2 files changed, 15 insertions(+), 65 deletions(-) create mode 100644 write-server/.dockerignore diff --git a/write-server/.dockerignore b/write-server/.dockerignore new file mode 100644 index 00000000..3545d283 --- /dev/null +++ b/write-server/.dockerignore @@ -0,0 +1,13 @@ +node_modules +.next +.git +.env +logs +backups +recycle +*.md +!package.json +!package-lock.json +nginx +systemd +scripts diff --git a/write-server/next.config.ts b/write-server/next.config.ts index 41d83767..a50daff4 100644 --- a/write-server/next.config.ts +++ b/write-server/next.config.ts @@ -1,88 +1,25 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { + devIndicators: false, + // 启用 standalone 输出模式(用于 Docker 部署) output: "standalone", // 实验性功能 experimental: { - // 启用服务器组件 serverActions: { bodySizeLimit: "10mb", }, }, - // 图片优化配置 - images: { - // 允许的图片域名 - remotePatterns: [ - { - protocol: "https", - hostname: "**", - }, - ], - // 图片格式 - formats: ["image/avif", "image/webp"], - }, - // 压缩配置 compress: true, - // 严格模式 - reactStrictMode: true, - // 环境变量 env: { BLOG_ROOT: process.env.BLOG_ROOT || "", }, - - // Webpack 配置 - webpack: (config, { isServer }) => { - // 修复某些依赖的兼容性问题 - if (!isServer) { - config.resolve.fallback = { - ...config.resolve.fallback, - fs: false, - net: false, - tls: false, - }; - } - return config; - }, - - // 重写规则(可选) - async rewrites() { - return [ - // API 代理(如果需要) - // { - // source: '/api/:path*', - // destination: 'http://backend:3000/api/:path*', - // }, - ]; - }, - - // 头部配置 - async headers() { - return [ - { - source: "/(.*)", - headers: [ - { - key: "X-Frame-Options", - value: "SAMEORIGIN", - }, - { - key: "X-Content-Type-Options", - value: "nosniff", - }, - { - key: "X-XSS-Protection", - value: "1; mode=block", - }, - ], - }, - ]; - }, }; export default nextConfig;