-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
39 lines (33 loc) · 1.42 KB
/
next.config.ts
File metadata and controls
39 lines (33 loc) · 1.42 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
import { withPayload } from '@payloadcms/next/withPayload'
import { NextConfig } from 'next'
import { RemotePattern } from 'next/dist/shared/lib/image-config'
const SERVER_URL =
process.env['VERCEL_ENV'] === 'production'
? process.env['VERCEL_PROJECT_PRODUCTION_URL']
: process.env['VERCEL_ENV'] === 'preview' || process.env['VERCEL_ENV'] === 'development'
? process.env['VERCEL_URL']
: 'localhost:3000'
const SERVER_PROTOCOL = process.env['VERCEL_ENV'] ? 'https' : 'http'
const nextConfig: NextConfig = {
turbopack: {
resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.wasm', '.json'],
},
reactStrictMode: true,
serverExternalPackages: ['@napi-rs/canvas', 'node-vibrant', 'dompurify', 'svgo'],
eslint: { ignoreDuringBuilds: true },
images: {
formats: ['image/avif', 'image/webp'],
remotePatterns: [
!process.env['VERCEL_ENV'] ? { hostname: 'localhost', port: '3000' } : null,
process.env['VERCEL_ENV'] ? { hostname: SERVER_URL, protocol: SERVER_PROTOCOL } : null,
{ hostname: 'daniel.heene.io', protocol: 'https' },
{ hostname: 'daniel.heene.dev', protocol: 'https' },
{ hostname: '*.vercel.app', protocol: 'https' },
].filter(Boolean) as RemotePattern[],
},
env: {
NEXT_PUBLIC_SERVER_URL: `${SERVER_PROTOCOL}://${SERVER_URL}`,
PAYLOAD_PUBLIC_SERVER_URL: `${SERVER_PROTOCOL}://${SERVER_URL}`,
},
}
export default withPayload(nextConfig)