-
Notifications
You must be signed in to change notification settings - Fork 4
/
next.config.mjs
48 lines (39 loc) · 1.48 KB
/
next.config.mjs
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
import NextBundleAnalyzer from '@next/bundle-analyzer'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const isFly = process.env.FLY_MACHINE_ID
const isVercel = process.env.IS_VERCEL_ENV === 'true'
const isProduction = process.env.NODE_ENV === 'production' || isVercel || isFly
const withBundleAnalyzer = NextBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
openAnalyzer: true,
})
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
cleanDistDir: true,
reactStrictMode: true,
poweredByHeader: false,
productionBrowserSourceMaps: false,
images: { remotePatterns: [{ protocol: 'https', hostname: '**' }] },
// @ref: https://nextjs.org/blog/next-14-1#improved-self-hosting
cacheMaxMemorySize: 0, // disable default in-memory caching
cacheHandler:
process.env.NODE_ENV === 'production' && !isVercel
? resolve(__dirname, 'scripts/cache-handler.mjs')
: undefined,
eslint: { ignoreDuringBuilds: isProduction },
typescript: { ignoreBuildErrors: isProduction },
logging: { fetches: { fullUrl: true } },
experimental: {
// This is required for the experimental feature of
// pre-populating the cache with the initial data.
instrumentationHook: true,
},
rewrites() {
return [{ source: '/healthz', destination: '/api/healthz' }]
},
}
export default withBundleAnalyzer(nextConfig)