Files
OpenFlare/frontend/next.config.ts
T
ryan 63cd906cfc refactor(repo): consolidate openflare-server to root and move subprojects to internal/apps
- Merge all files inside openflare-server to the repository root directory.
- Relocate agent, relay, and flared subprojects from internal/ to internal/apps/.
- Combine docker-compose files and update build context paths to root.
- Update GitHub workflows and Dockerfiles to refer to new directories and package names.
- Rewrite Go package imports across all files.
- Resolve database renew test race condition and clean up docs.
2026-06-19 14:23:29 +08:00

43 lines
1.2 KiB
TypeScript

import type {NextConfig} from "next";
const isExport = process.env.NEXT_STANDALONE_EXPORT === 'true';
const nextConfig: NextConfig = {
reactCompiler: true,
// Prevent 308 redirects on /api/* trailing slashes; dev rewrites proxy legacy APIs as-is.
skipTrailingSlashRedirect: true,
experimental: {
},
...(isExport ? { output: 'export' } : {
async redirects() {
return [
{ source: '/openflare', destination: '/', permanent: true },
{ source: '/openflare/:path*', destination: '/:path*', permanent: true },
{ source: '/home', destination: '/', permanent: true },
];
},
async rewrites() {
const backendUrl = process.env.WAVELET_BACKEND_URL || 'http://localhost:3000';
return [
// 上传文件静态资源
{
source: '/f/:id',
destination: `${ backendUrl }/f/:id`,
},
// robots.txt 路由代理到后端动态接口
{
source: '/robots.txt',
destination: `${ backendUrl }/robots.txt`,
},
// 标准 RESTful API 接口
{
source: '/api/:path*',
destination: `${ backendUrl }/api/:path*`,
}
];
},
})
};
export default nextConfig;