Files
谢宇宁andClaude Opus 5.5 6bd5cc665a Initial commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 20:30:26 +07:00

30 lines
998 B
TypeScript
Raw Permalink 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";
/** 本地调试代理目标,见 config/*.env / .env.local 的 API_PROXY_TARGET */
const apiProxyTarget = (process.env.API_PROXY_TARGET || "").replace(/\/$/, "");
const appEnv = process.env.APP_ENV;
const nextConfig: NextConfig = {
output: "standalone",
// 仅在显式 APP_ENV=test|development 时分目录;未设置 / production 仍用 .next
distDir:
appEnv === "test" ? ".next-test" : appEnv === "development" ? ".next-dev" : ".next",
poweredByHeader: false,
cacheComponents: true,
partialPrefetching: true,
// 用 127.0.0.1 打开本地 dev 时允许 HMR(默认只放行 localhost)
allowedDevOrigins: ["127.0.0.1"],
async rewrites() {
if (!apiProxyTarget) return [];
return [
{
source: "/api/:path*",
destination: `${apiProxyTarget}/api/:path*`,
},
// /h5/m3u8、/enkey、/newenkey 由 route handler 代理,密钥地址不带尾斜杠
];
},
};
export default nextConfig;