36 lines
1007 B
TypeScript
36 lines
1007 B
TypeScript
import type { NextConfig } from "next"
|
|
import { subConfigList } from "./components/layout/common"
|
|
|
|
const isDevelopment = process.env.NODE_ENV === "development"
|
|
|
|
const nextConfig: NextConfig = {
|
|
/* config options here */
|
|
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
// Keep build-time output selection for production builds, but avoid
|
|
// surfacing export/middleware warnings in `next dev`.
|
|
output: isDevelopment
|
|
? undefined
|
|
: (process.env.NEXT_PUBLIC_OUTPUT_TYPE as
|
|
| "standalone"
|
|
| "export"
|
|
| undefined),
|
|
async rewrites() {
|
|
// 应用代理baseAppProxy
|
|
const repoProxy = subConfigList.map(({ source, url }) => {
|
|
return {
|
|
source,
|
|
destination: `${url}${source}`,
|
|
}
|
|
})
|
|
const repoPathProxy = subConfigList.map(({ source, url }) => {
|
|
return {
|
|
source: `${source}/:path*`,
|
|
destination: `${url}${source}/:path*`,
|
|
}
|
|
})
|
|
return [...repoProxy, ...repoPathProxy]
|
|
},
|
|
}
|
|
|
|
export default nextConfig
|