Files
spring_blogs/next.config.ts
T
2026-07-14 18:43:40 +08:00

46 lines
949 B
TypeScript

import type { NextConfig } from "next";
const serverApiBaseUrl = (
process.env.SERVER_API_BASE_URL ??
(process.env.NODE_ENV === "production"
? "http://127.0.0.1:8080/api"
: "http://localhost:8080/api")
).replace(/\/+$/, "");
const nextConfig: NextConfig = {
distDir: process.env.NEXT_DIST_DIR || ".next",
output: "standalone",
async rewrites() {
return [
{
source: "/api/music/:path*",
destination: "/api/music/:path*",
},
{
source: "/api/music",
destination: "/api/music",
},
{
source: "/api/:path*",
destination: `${serverApiBaseUrl}/:path*`,
},
];
},
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "images.unsplash.com",
},
{
protocol: "http",
hostname: "localhost",
port: "8080",
},
],
},
};
export default nextConfig;