This commit is contained in:
ryan
2026-07-13 15:08:40 +08:00
parent 08e8eea932
commit 1eff7878a1
441 changed files with 26491 additions and 18405 deletions
+35 -28
View File
@@ -1,4 +1,4 @@
import type {NextConfig} from "next";
import type { NextConfig } from 'next';
const isExport = process.env.NEXT_STANDALONE_EXPORT === 'true';
@@ -9,35 +9,42 @@ const nextConfig: NextConfig = {
experimental: {
turbopackFileSystemCacheForBuild: true,
},
...(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`,
...(isExport
? { output: 'export' }
: {
async redirects() {
return [
{ source: '/openflare', destination: '/', permanent: true },
{
source: '/openflare/:path*',
destination: '/:path*',
permanent: true,
},
{ source: '/home', destination: '/', permanent: true },
];
},
// robots.txt 路由代理到后端动态接口
{
source: '/robots.txt',
destination: `${ backendUrl }/robots.txt`,
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*`,
},
];
},
// 标准 RESTful API 接口
{
source: '/api/:path*',
destination: `${ backendUrl }/api/:path*`,
}
];
},
})
}),
};
export default nextConfig;