-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.mjs
108 lines (103 loc) · 2.39 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
import { env } from "node:process";
import { withFaust, getWpHostname } from "@faustwp/core";
import createMDX from "@next/mdx";
import { transformerNotationDiff } from "@shikijs/transformers";
import { withWPEConfig } from "@wpengine/atlas-next";
import { createSecureHeaders } from "next-secure-headers";
import recmaNextjsStaticProps from "recma-nextjs-static-props";
import rehypeCallouts from "rehype-callouts";
import rehypeMdxImportMedia from "rehype-mdx-import-media";
import { rehypePrettyCode } from "rehype-pretty-code";
import rehypeSlug from "rehype-slug";
import remarkGfm from "remark-gfm";
import redirectsOldSite from "./redirects-old-site.mjs";
import smartSearchPlugin from "./src/lib/smart-search-plugin.mjs";
const newRedirects = [
{
source: "/discord",
destination: "https://discord.gg/headless-wordpress-836253505944813629",
permanent: false,
},
{
source: "/community-meeting",
destination:
"https://discord.gg/headless-wordpress-836253505944813629?event=1336404483013480588",
permanent: false,
},
];
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
trailingSlash: true,
reactStrictMode: true,
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
sassOptions: {
includePaths: ["node_modules"],
},
eslint: {
ignoreDuringBuilds: true,
},
redirects() {
return [...redirectsOldSite, ...newRedirects];
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: getWpHostname(),
pathname: "/**",
},
],
},
i18n: {
locales: ["en"],
defaultLocale: "en",
},
async headers() {
return [
{
source: "/:path*",
headers: createSecureHeaders({
xssProtection: false,
}),
},
];
},
webpack: (config, { isServer }) => {
if (isServer) {
config.plugins.push(
smartSearchPlugin({
endpoint: env.NEXT_PUBLIC_SEARCH_ENDPOINT,
accessToken: env.NEXT_SEARCH_ACCESS_TOKEN,
}),
);
}
return config;
},
};
const withMDX = createMDX({
options: {
recmaPlugins: [recmaNextjsStaticProps],
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeMdxImportMedia,
rehypeSlug,
rehypeCallouts,
[
rehypePrettyCode,
{
transformers: [
transformerNotationDiff({
matchAlgorithm: "v3",
}),
],
theme: "github-dark-dimmed",
defaultLang: "plaintext",
bypassInlineCode: false,
},
],
],
},
});
export default withWPEConfig(withFaust(withMDX(nextConfig)));