-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
25 lines (22 loc) · 779 Bytes
/
Copy pathnext.config.js
File metadata and controls
25 lines (22 loc) · 779 Bytes
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
const staticExport = process.env.STATIC_EXPORT === 'true'
const appMode = process.env.APP_MODE || 'full'
/** @type {import('next').NextConfig} */
const nextConfig = {
output: staticExport ? 'export' : 'standalone',
trailingSlash: true,
allowedDevOrigins: ['127.0.0.1', 'localhost'],
images: {
unoptimized: staticExport,
},
}
if (!staticExport && appMode === 'api-only') {
const serverPort = process.env.SERVER_PORT || '3000'
const serverHost = process.env.HOST || 'localhost'
const apiUrl = process.env.NEXT_PUBLIC_API_URL || `http://${serverHost}:${serverPort}`
nextConfig.rewrites = async () => ({
beforeFiles: [],
afterFiles: [],
fallback: [{ source: '/api/:path*', destination: `${apiUrl}/api/:path*` }],
})
}
export default nextConfig