-
Notifications
You must be signed in to change notification settings - Fork 10
/
next.config.js
54 lines (50 loc) · 1.8 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
/**
* ESModules can't be require'd, so we have to use dynamic import.
* Fortunately, `next.config.js` can export a promise, so we wrap everything in an async function.
*/
const nextConfigAsync = async () => {
const nextConfig = /** @type {import('next').NextConfig} */ ({
reactStrictMode: true,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
images: {
domains: [
/* via.placeholder.com domain should be removed for production */
'via.placeholder.com',
'raw.githubusercontent.com',
'user-images.githubusercontent.com',
],
},
});
const remarkGfm = (await import('remark-gfm')).default;
const remarkFrontmatter = (await import('remark-frontmatter')).default;
const remarkMdxFrontmatter = (await import('remark-mdx-frontmatter')).default;
const recmaStaticProps = (await import('recma-nextjs-static-props')).default;
const recmaStaticImages = (await import('@helmturner/recma-next-static-images')).default;
const recmaStaticImagesConfig =
/** @type {import('@helmturner/recma-next-static-images').Options} */ ({
cacheDirectory: 'public/content',
});
const remarkMdxFrontmatterConfig =
/** @type {import('remark-mdx-frontmatter').RemarkMdxFrontmatterOptions} */ ({
name: 'frontmatter'
});
const configureMDX = (await import('@next/mdx')).default;
const withMDX = configureMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [
remarkGfm,
remarkFrontmatter,
[remarkMdxFrontmatter, remarkMdxFrontmatterConfig]
],
rehypePlugins: [],
recmaPlugins: [
recmaStaticProps,
[recmaStaticImages, recmaStaticImagesConfig],
],
providerImportSource: '@mdx-js/react',
},
});
return withMDX(nextConfig);
};
module.exports = nextConfigAsync();