Files
gitlab-instance-0a899031_no…/next.config.ts
2026-03-12 04:11:29 -05:00

26 lines
858 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 资源
// 需完全重启 dev 服务Ctrl+C 后 pnpm dev后生效
allowedDevOrigins: [
"192.168.41.222",
"192.168.41.222:3000",
"http://192.168.41.222",
"http://192.168.41.222:3000",
"http://192.168.41.222:3001",
],
};
export default nextConfig;