-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
68 lines (61 loc) · 1.68 KB
/
next.config.ts
File metadata and controls
68 lines (61 loc) · 1.68 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
import type { NextConfig } from "next";
// Get Supabase URL from environment variable
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || '';
// Extract hostname from Supabase URL
const getSupabaseHostname = (url: string): string | null => {
try {
const urlObj = new URL(url);
return urlObj.hostname;
} catch {
return null;
}
};
const supabaseHostname = getSupabaseHostname(supabaseUrl);
// Build remote patterns dynamically
const remotePatterns: Array<{
protocol: 'http' | 'https';
hostname: string;
pathname: string;
}> = [];
if (supabaseHostname) {
// Add the specific Supabase hostname (works for both local and cloud)
const protocol = supabaseUrl.startsWith('https') ? 'https' : 'http';
remotePatterns.push({
protocol,
hostname: supabaseHostname,
pathname: '/storage/v1/object/public/**',
});
} else {
// Fallback: add common patterns if URL is not available
remotePatterns.push(
{
protocol: 'https',
// Supabase hosted projects are on <project-ref>.supabase.co
// Next.js remotePatterns supports wildcard matching with '*'
hostname: '*.supabase.co',
pathname: '/storage/v1/object/public/**',
},
{
// Some Supabase projects can use regional domains (e.g. supabase.in)
protocol: 'https',
hostname: '*.supabase.in',
pathname: '/storage/v1/object/public/**',
},
{
protocol: 'http',
hostname: 'localhost',
pathname: '/storage/v1/object/public/**',
}
);
}
const nextConfig: NextConfig = {
images: {
remotePatterns,
},
serverExternalPackages: [
'@react-pdf/renderer',
'chrome-aws-lambda',
'playwright-core',
],
};
export default nextConfig;