-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
119 lines (111 loc) · 3.31 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
* Everything starts here. This is the main Next.js configuration file.
* @see https://nextjs.org/docs/app/building-your-application/configuring
*/
import nextIntlPlugin from "next-intl/plugin";
import withBundleAnalyzer from "@next/bundle-analyzer";
import createMDX from "@next/mdx";
import { createSecureHeaders } from "next-secure-headers";
import remarkGfm from "remark-gfm";
/**
* If you need, you can very dangerously run build or dev with SKIP_ENV_VALIDATION.
* It skips environment vars validation. This is especially useful for Docker builds.
* @example !process.env.SKIP_ENV_VALIDATION && (await import("./src/data/env/env.mjs"));
*/
!process.env.SKIP_ENV_VALIDATION && (await import("./src/data/env/env.mjs"));
/**
* The whitelist list of domains,
* that are allowed to show media.
*/
const hostnames = [
"avatars.githubusercontent.com",
"lh3.googleusercontent.com",
"githubusercontent.com",
"googleusercontent.com",
"images.unsplash.com",
"cdn.discordapp.com",
"res.cloudinary.com",
"www.gravatar.com",
"api.dicebear.com",
"img.youtube.com",
"discordapp.com",
"pbs.twimg.com",
"i.imgur.com",
"utfs.io",
"images.pexels.com",
"a0.muscache.com",
"www.gstatic.com",
];
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
swcMinify: true,
/**
* Toggle experimental features.
*/
experimental: {
outputFileTracingExcludes: {
"*": [
"node_modules/@swc/core-linux-x64-gnu",
"node_modules/@swc/core-linux-x64-musl",
"node_modules/@esbuild/linux-x64",
],
},
serverActions: true,
typedRoutes: false,
mdxRs: true,
},
/**
* Configuration for next/image.
*/
images: {
unoptimized: true,
formats: ["image/avif", "image/webp"],
remotePatterns: hostnames.map((hostname) => ({
protocol: "https",
hostname,
})),
},
/**
* Set custom website headers with next-secure-headers.
* @see https://github.com/jagaapple/next-secure-headers
*/
async headers() {
return [
{
/**
* Set security headers to all routes.
*/
source: "/(.*)",
headers: createSecureHeaders(),
},
];
},
/**
* Dangerously allow builds to successfully complete
* even if your project has the types/eslint errors.
*
* Next.js has built-in support for TypeScript, using its own plugin.
* But while you use `pnpm build`, it stops on the first type errors.
* So you can use `pnpm bv` to check all type warns and errors at once.
*/
typescript: { ignoreBuildErrors: false },
eslint: { ignoreDuringBuilds: false },
};
/**
* Create a config wrapper required to integrate a modern Nextjs MDX support.
* @see https://nextjs.org/docs/app/building-your-application/configuring/mdx
*/
const withMDX = createMDX({ options: { remarkPlugins: [remarkGfm] } });
/**
* Create configuration wrapper required for using next-intl with React Server Components.
* @see https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components
*/
const withNextIntl = nextIntlPlugin("./src/i18n/server.ts");
const withBundleAnalyzerConfig = withBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
/**
* Send the config to server while build or lint.
*/
export default withBundleAnalyzerConfig(withNextIntl(withMDX(nextConfig)));