ChatGPT-Next-Web/next.config.mjs

41 lines
791 B
JavaScript
Raw Normal View History

2023-03-07 15:23:54 +00:00
/** @type {import('next').NextConfig} */
2023-03-12 19:06:21 +00:00
2023-03-12 19:21:48 +00:00
const nextConfig = {
async rewrites() {
const ret = [
{
source: "/api/proxy/:path*",
destination: "https://api.openai.com/:path*",
},
2023-05-14 15:25:22 +00:00
{
source: "/google-fonts/:path*",
destination: "https://fonts.googleapis.com/:path*",
},
];
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 14:18:03 +00:00
return {
2023-05-05 14:49:41 +00:00
beforeFiles: ret,
2023-05-04 14:18:03 +00:00
};
},
2023-03-09 17:01:40 +00:00
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
2023-04-10 17:21:34 +00:00
});
2023-03-07 15:23:54 +00:00
2023-03-09 17:01:40 +00:00
return config;
2023-04-10 17:21:34 +00:00
},
output: "standalone",
2023-03-12 19:21:48 +00:00
};
2023-03-09 17:01:40 +00:00
2023-05-03 15:08:37 +00:00
export default nextConfig;