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 = {
|
2023-05-04 00:49:33 +09:00
|
|
|
async rewrites() {
|
2023-05-09 01:39:00 +09:00
|
|
|
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",
|
|
|
|
},
|
2023-05-09 01:39:00 +09:00
|
|
|
];
|
2023-05-04 00:49:33 +09:00
|
|
|
|
|
|
|
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-05-04 00:49:33 +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;
|