forked from FairPlayTeam/FairPlay-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
29 lines (25 loc) · 752 Bytes
/
next.config.ts
File metadata and controls
29 lines (25 loc) · 752 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
26
27
28
29
import type { NextConfig } from "next";
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
const isDev = process.env.NODE_ENV === "development";
const remoteImageHostnames = ["assets.fairplay.video"];
if (apiBaseUrl) {
try {
const { hostname } = new URL(apiBaseUrl);
if (hostname && !remoteImageHostnames.includes(hostname)) {
remoteImageHostnames.push(hostname);
}
} catch {
// Ignore invalid env values to avoid crashing the config at build time.
}
}
const nextConfig: NextConfig = {
pageExtensions: ["ts", "tsx"],
images: {
dangerouslyAllowLocalIP: isDev,
remotePatterns: remoteImageHostnames.map((hostname) => ({
protocol: "https",
hostname,
})),
},
};
export default nextConfig;