提供基本前后端骨架
This commit is contained in:
36
frontend/next.config.ts
Normal file
36
frontend/next.config.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { NextConfig } from 'next';
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
// 生产环境静态导出,开发环境正常运行
|
||||
...(isProd ? { output: 'export' } : {}),
|
||||
|
||||
// 图片优化(静态导出时禁用)
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
|
||||
// 尾随斜杠
|
||||
trailingSlash: false,
|
||||
|
||||
// 开发环境 API 代理
|
||||
async rewrites() {
|
||||
if (!isProd) {
|
||||
return [
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: 'http://localhost:8000/api/:path*',
|
||||
},
|
||||
{
|
||||
source: '/health',
|
||||
destination: 'http://localhost:8000/health',
|
||||
},
|
||||
];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
Reference in New Issue
Block a user