mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 22:06:38 +08:00
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import type {NextConfig} from "next";
|
|
|
|
const isExport = process.env.NEXT_STANDALONE_EXPORT === 'true';
|
|
|
|
const nextConfig: NextConfig = {
|
|
reactCompiler: true,
|
|
experimental: {
|
|
},
|
|
...(isExport ? { output: 'export' } : {
|
|
async rewrites() {
|
|
const backendUrl = process.env.WAVELET_BACKEND_URL || 'http://localhost:8000';
|
|
return [
|
|
// 易支付兼容接口 - 创建订单
|
|
{
|
|
source: '/epay/pay/:path*',
|
|
destination: `${ backendUrl }/pay/:path*`,
|
|
},
|
|
// 易支付兼容接口 - 查询订单和退款
|
|
{
|
|
source: '/epay/api.php',
|
|
destination: `${ backendUrl }/api.php`,
|
|
},
|
|
// Credit 协议接口 - 商户分发
|
|
{
|
|
source: '/lpay/distribute',
|
|
destination: `${ backendUrl }/pay/distribute`,
|
|
},
|
|
// 上传文件静态资源
|
|
{
|
|
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;
|