-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnext.config.ts
More file actions
141 lines (137 loc) · 3.17 KB
/
next.config.ts
File metadata and controls
141 lines (137 loc) · 3.17 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import type { NextConfig } from "next";
// Build the list of remote image patterns once so we avoid the TS union
// issue that arises from conditional spread syntax inside the config
const remoteImagePatterns: {
protocol: "https";
hostname: string;
pathname: "/*" | "/**";
}[] = [
{
protocol: "https" as const,
hostname: "**.deepfi.sh",
pathname: "/**",
},
{
protocol: "https" as const,
hostname: "deepfi.sh",
pathname: "/**",
},
{
protocol: "https" as const,
hostname: "fal.media",
pathname: "/**",
},
{
protocol: "https" as const,
hostname: "replicate.delivery",
pathname: "/**",
},
{
protocol: "https" as const,
hostname: "**.replicate.delivery",
pathname: "/**",
},
{
protocol: "https" as const,
hostname: "**.vercel-storage.com",
pathname: "/**",
},
{
protocol: "https",
hostname: "**.fal.media",
pathname: "/**",
},
{
protocol: "https",
hostname: "img.clerk.com",
pathname: "/**",
},
{
protocol: "https",
hostname: "storage.googleapis.com",
pathname: "/**",
},
];
if (process.env.NEXT_PUBLIC_BLOB_URL) {
try {
const blobHost = new URL(process.env.NEXT_PUBLIC_BLOB_URL).hostname;
remoteImagePatterns.push({
protocol: "https",
hostname: blobHost,
pathname: "/**",
} as const);
} catch {}
}
const nextConfig: NextConfig = {
reactStrictMode: false,
transpilePackages: ["three"],
// devIndicators: false,
/**
* Allow the Next.js <Image /> component to load images hosted on
* external domains (Replicate CDN, Vercel blob storage and the
* optional NEXT_PUBLIC_BLOB_URL). Without this whitelist any page
* that tries to render such a URL will throw:
* "Invalid src prop on next/image, hostname is not configured…"
*/
images: {
remotePatterns: remoteImagePatterns,
},
// This is required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
compiler: {
// Remove console logs in production
removeConsole: process.env.NODE_ENV === "production" ? true : false,
},
experimental: {
// ppr: "incremental",
},
// Headers for better caching
// async headers() {
// return [
// {
// source: "/:path*",
// headers: [
// {
// key: "X-DNS-Prefetch-Control",
// value: "on",
// },
// ],
// },
// {
// source: "/fonts/:path*",
// headers: [
// {
// key: "Cache-Control",
// value: "public, max-age=31536000, immutable",
// },
// ],
// },
// {
// source: "/_next/static/:path*",
// headers: [
// {
// key: "Cache-Control",
// value: "public, max-age=31536000, immutable",
// },
// ],
// },
// ];
// },
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://us.i.posthog.com/:path*",
},
{
source: "/ingest/decide",
destination: "https://us.i.posthog.com/decide",
},
];
},
};
export default nextConfig;