-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathnext.config.ts
More file actions
73 lines (64 loc) · 1.77 KB
/
next.config.ts
File metadata and controls
73 lines (64 loc) · 1.77 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
// next.config.ts
import type { NextConfig } from 'next';
import createNextIntlPlugin from 'next-intl/plugin';
// FIX: Use require() for conditional dev init — next.config.ts runs in
// CommonJS context even with ESM tsconfig. Top-level await is not supported.
// This is the pattern recommended by OpenNext's official documentation.
if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { initOpenNextCloudflareForDev } = require('@opennextjs/cloudflare');
initOpenNextCloudflareForDev();
}
const withNextIntl = createNextIntlPlugin({
experimental: {
createMessagesDeclaration: './i18n/locales/en.json',
},
});
const config: NextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
images: {
remotePatterns: [
{ protocol: 'https', hostname: 'avatars.githubusercontent.com' },
{ protocol: 'https', hostname: 'github.com' },
{ protocol: 'https', hostname: 'i.api.dishis.tech' },
{ protocol: 'https', hostname: 'cdn.buymeacoffee.com' },
],
},
sassOptions: {
silenceDeprecations: ['legacy-js-api'],
},
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
experimental: {
optimizeCss: true,
},
async headers() {
return [
{
source: '/_next/image(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=86400, stale-while-revalidate=604800',
},
],
},
{
source: '/_next/static/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
];
},
};
export default withNextIntl(config);