This commit is contained in:
eric
2026-03-12 04:11:29 -05:00
parent 6f4e287ca3
commit 528044db7d
6 changed files with 21 additions and 52 deletions

View File

@@ -1,4 +1,14 @@
import type { NextConfig } from "next";
import { readFileSync, existsSync } from "fs";
import { join } from "path";
// 构建时自动加载 Server Actions 加密密钥,避免 "Failed to find Server Action" 部署错误
if (!process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY) {
const keyPath = join(__dirname, "config", "server-actions.key");
if (existsSync(keyPath)) {
process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = readFileSync(keyPath, "utf8").trim();
}
}
const nextConfig: NextConfig = {
// 局域网访问(如手机 192.168.x.x时允许跨域请求 _next 资源