's'
This commit is contained in:
@@ -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 资源
|
||||
|
||||
Reference in New Issue
Block a user