-
Notifications
You must be signed in to change notification settings - Fork 5
/
next.config.js
44 lines (43 loc) · 1000 Bytes
/
next.config.js
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
33
34
35
36
37
38
39
40
41
42
43
44
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
unoptimized: true,
},
async rewrites() {
return [
// Rewrite /citizen requests to the Flask API
{
source: '/citizen/:path*',
destination:
process.env.NODE_ENV === 'development'
? 'http://flask:5001/:path*' // Use service name 'flask' here
: '/citizen/:path*', // Production route for Flask (if different from dev)
},
// Keep the original API route for Next.js
{
source: '/api/:path*',
destination:
process.env.NODE_ENV === 'development'
? 'http://127.0.0.1:5328/api/:path*' // Next.js API during development
: '/api/', // Next.js API in production
},
];
},
webpack: (config, { isServer }) => {
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
},
};
if (!isServer) {
config.node = {
...config.node,
};
}
return config;
},
};
module.exports = nextConfig;