-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
101 lines (95 loc) · 2.89 KB
/
next.config.mjs
File metadata and controls
101 lines (95 loc) · 2.89 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// @ts-check
import nextI18NextConfig from "./next-i18next.config.js";
import dotenv from "dotenv";
dotenv.config();
/**
* Customize the build output type
* - `undefined`: The default build output, `.next` directory, that works with production mode `next start` or a hosting provider like Vercel
* - `'standalone'`: A standalone build output, `.next/standalone` directory, that only includes necessary files/dependencies. Useful for self-hosting in a Docker container.
* - `'export'`: An exported build output, `out` directory, that only includes static HTML/CSS/JS. Useful for self-hosting without a Node.js server.
*
* @type {any}
*/
const output = process.env.NEXT_OUTPUT;
const backendPort = process.env.NEXT_PUBLIC_BACKEND_PORT || 4000;
/**
* Next.js configuration
*
* @see https://nextjs.org/docs/app/api-reference/next-config-js
*
* @param {string} phase
* @param {{
* defaultConfig: import('next').NextConfig
* }} options
* @returns {Promise<import('next').NextConfig>}
*/
const nextConfig = async (phase, { defaultConfig }) => {
return {
i18n: nextI18NextConfig.i18n,
trailingSlash: false,
reactStrictMode: true,
poweredByHeader: false,
async rewrites() {
return [
{
source: "/api/:path*",
destination: `http://localhost:${backendPort}/api/:path*`, // Proxy to Backend
},
{
source: "/uploads/:path*",
destination: `http://localhost:${backendPort}/uploads/:path*`, // Proxy to Backend
},
{
source: "/themes/:path*",
destination: `http://localhost:${backendPort}/themes/:path*`, // Proxy to Backend
},
];
},
output,
webpack: (config, { isServer, dev }) => {
config.externals.push("pino-pretty", "lokijs", "encoding");
if (dev && !isServer) {
config.watchOptions = {
ignored: /node_modules/,
aggregateTimeout: 300,
poll: 1000,
};
}
return config;
},
images: {
/**
* When generating static version of your website (export), Next.js can't optimize images for you
* so you will need to disable this option.
*/
unoptimized: output === "export",
remotePatterns: [
{
protocol: "https",
hostname: "cdn.dribbble.com",
},
{
protocol: "https",
hostname: "i.pinimg.com",
},
{
protocol: "https",
hostname: "miro.medium.com",
},
{
protocol: "https",
hostname: "images.pexels.com",
},
{
protocol: "https",
hostname: "barcode.tec-it.com",
},
{
protocol: "https",
hostname: "flowbite.s3.amazonaws.com",
},
],
},
};
};
export default nextConfig;