/** @type {import('next').NextConfig} */ | |
const API_HOST = process.env.API_HOST || '0.0.0.0' | |
const API_PORT = process.env.API_PORT || 7860 | |
console.log(`API_HOST: ${API_HOST}`) | |
console.log(`API_PORT: ${API_PORT}`) | |
console.log(`NODE_ENV: ${process.env.NODE_ENV}`) | |
const nextConfig = { | |
output: 'export', | |
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html` | |
// trailingSlash: true, | |
// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href` | |
// skipTrailingSlashRedirect: true, | |
// Optional: Change the output directory `out` -> `dist` | |
distDir: 'dist', | |
async rewrites() { | |
if (process.env.NODE_ENV !== 'production') { | |
return [ | |
{ | |
source: '/api/:path*', | |
destination: `http://${API_HOST}:${API_PORT}/:path*`, | |
}, | |
] | |
} | |
return [] | |
} | |
} | |
module.exports = nextConfig | |