NextChat-U/next.config.mjs

45 lines
900 B
JavaScript
Raw Normal View History

2023-03-08 00:23:54 +09:00
/** @type {import('next').NextConfig} */
2023-03-13 04:06:21 +09:00
2023-03-13 04:21:48 +09:00
const nextConfig = {
async rewrites() {
const ret = [
{
source: "/api/proxy/:path*",
destination: "https://api.openai.com/:path*",
},
2023-05-15 00:25:22 +09:00
{
source: "/google-fonts/:path*",
destination: "https://fonts.googleapis.com/:path*",
},
2023-05-25 02:04:37 +09:00
{
source: "/sharegpt",
destination: "https://sharegpt.com/api/conversations",
},
];
const apiUrl = process.env.API_URL;
if (apiUrl) {
console.log("[Next] using api url ", apiUrl);
ret.push({
source: "/api/:path*",
destination: `${apiUrl}/:path*`,
});
}
2023-05-04 23:18:03 +09:00
return {
2023-05-05 23:49:41 +09:00
beforeFiles: ret,
2023-05-04 23:18:03 +09:00
};
},
2023-03-10 02:01:40 +09:00
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
2023-04-11 02:21:34 +09:00
});
2023-03-08 00:23:54 +09:00
2023-03-10 02:01:40 +09:00
return config;
2023-04-11 02:21:34 +09:00
},
output: "standalone",
2023-03-13 04:21:48 +09:00
};
2023-03-10 02:01:40 +09:00
2023-05-04 00:08:37 +09:00
export default nextConfig;