-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.ts
71 lines (65 loc) · 1.85 KB
/
next.config.ts
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
import createBundleAnalyzer from "@next/bundle-analyzer";
import localesPlugin from "@react-aria/optimize-locales-plugin";
import type { NextConfig } from "next";
import createI18nPlugin from "next-intl/plugin";
import { env } from "@/config/env.config";
const config: NextConfig = {
/** Compression should be handled by nginx reverse proxy. */
compress: false,
eslint: {
dirs: [process.cwd()],
ignoreDuringBuilds: true,
},
headers() {
/** @type {Awaited<ReturnType<NonNullable<NextConfig["headers"]>>>} */
const headers = [
/** @see https://nextjs.org/docs/app/building-your-application/deploying#streaming-and-suspense */
{
source: "/:path*{/}?",
headers: [
{
key: "X-Accel-Buffering",
value: "no",
},
],
},
];
return Promise.resolve(headers);
},
images: {
deviceSizes: [480, 640, 750, 828, 1080, 1200, 1920, 2048, 3840],
},
logging: {
fetches: {
fullUrl: true,
},
},
output: env.BUILD_MODE,
typescript: {
ignoreBuildErrors: true,
},
webpack(config, { isServer }) {
/**
* @see https://react-spectrum.adobe.com/react-aria/ssr.html#nextjs-app-router
*/
if (!isServer) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
config.plugins.push(localesPlugin.webpack({ locales: [] }));
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return config;
},
};
const plugins: Array<(config: NextConfig) => NextConfig> = [
createBundleAnalyzer({ enabled: env.BUNDLE_ANALYZER === "enabled" }),
createI18nPlugin({
experimental: {
/** @see https://v4.next-intl.dev/docs/workflows/typescript#messages-arguments */
createMessagesDeclaration: "./messages/en.json",
},
requestConfig: "./lib/i18n/get-request-config.ts",
}),
];
export default plugins.reduce((config, plugin) => {
return plugin(config);
}, config);