generated from acdh-oeaw/template-app-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
53 lines (47 loc) · 1.41 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
/** @typedef {import('next').NextConfig} NextConfig */
import createBundleAnalyzer from "@next/bundle-analyzer";
import createMdxPlugin from "@next/mdx";
import localesPlugin from "@react-aria/optimize-locales-plugin";
import createI18nPlugin from "next-intl/plugin";
import { env } from "./config/env.config.js";
import { createConfig as createMdxConfig } from "./config/mdx.config.js";
/** @type {NextConfig} */
const config = {
eslint: {
dirs: [process.cwd()],
ignoreDuringBuilds: true,
},
logging: {
fetches: {
fullUrl: true,
},
},
output: env.BUILD_MODE,
pageExtensions: ["ts", "tsx", "md", "mdx"],
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.ts"),
createMdxPlugin({
extension: /\.(md|mdx)$/,
options: await createMdxConfig(),
}),
];
export default plugins.reduce((config, plugin) => {
return plugin(config);
}, config);