generated from acdh-oeaw/template-app-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
80 lines (72 loc) · 1.92 KB
/
next.config.js
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
74
75
76
77
78
79
80
/** @typedef {import("next").NextConfig} NextConfig */
import createBundleAnalyzer from "@next/bundle-analyzer";
import localesPlugin from "@react-aria/optimize-locales-plugin";
import createI18nPlugin from "next-intl/plugin";
import { env } from "./config/env.config.js";
/** @type {NextConfig} */
const config = {
/** Compression should be handled by nginx reverse proxy. */
compress: false,
eslint: {
dirs: [process.cwd()],
ignoreDuringBuilds: true,
},
experimental: {
instrumentationHook: 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);
},
logging: {
fetches: {
fullUrl: true,
},
},
output: env.BUILD_MODE,
redirects() {
/** @type {Awaited<ReturnType<NonNullable<NextConfig["redirects"]>>>} */
const redirects = [
{
source: "/admin",
destination: "/keystatic",
permanent: false,
},
];
return Promise.resolve(redirects);
},
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;
},
};
/** @type {Array<(config: NextConfig) => NextConfig>} */
const plugins = [
createBundleAnalyzer({ enabled: env.BUNDLE_ANALYZER === "enabled" }),
createI18nPlugin("./lib/i18n/get-request-config.ts"),
];
export default plugins.reduce((config, plugin) => {
return plugin(config);
}, config);