40 lines
882 B
TypeScript
40 lines
882 B
TypeScript
import type { NextConfig } from "next"
|
|
|
|
const subList: { source: string; url: string }[] = [
|
|
{
|
|
source: "/image",
|
|
url: "http://localhost:5532",
|
|
},
|
|
{
|
|
source: "/video",
|
|
url: "http://localhost:5533",
|
|
},
|
|
]
|
|
|
|
const nextConfig: NextConfig = {
|
|
/* config options here */
|
|
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
output: process.env.NEXT_PUBLIC_OUTPUT_TYPE as
|
|
| "standalone"
|
|
| "export"
|
|
| undefined,
|
|
async rewrites() {
|
|
// 应用代理baseAppProxy
|
|
const repoProxy = subList.map(({ source, url }) => {
|
|
return {
|
|
source,
|
|
destination: `${url}${source}`,
|
|
}
|
|
})
|
|
const repoPathProxy = subList.map(({ source, url }) => {
|
|
return {
|
|
source: `${source}/:path*`,
|
|
destination: `${url}${source}/:path*`,
|
|
}
|
|
})
|
|
return [...repoProxy, ...repoPathProxy]
|
|
},
|
|
}
|
|
|
|
export default nextConfig
|