File size: 949 Bytes
fb963ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/** @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