19 lines
587 B
JavaScript
19 lines
587 B
JavaScript
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
reactStrictMode: true,
|
|
// 工作区存在多个 lockfile,显式指定本应用为文件追踪根,避免 Next 推断到上层目录。
|
|
outputFileTracingRoot: import.meta.dirname,
|
|
// 将 /api/* 代理到 NestJS 后端,避免浏览器跨域并统一前端调用路径。
|
|
async rewrites() {
|
|
const backend = process.env.BACKEND_URL ?? 'http://localhost:3000';
|
|
return [
|
|
{
|
|
source: '/api/:path*',
|
|
destination: `${backend}/api/:path*`,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|