-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
40 lines (34 loc) · 1.3 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
import { dirname } from 'path';
import { fileURLToPath } from 'url';
// Derive __dirname equivalent in ESM
const __dirname = dirname(fileURLToPath(import.meta.url));
// The rest of your Next.js config
import rehypePrism from '@mapbox/rehype-prism';
import nextMDX from '@next/mdx';
import remarkGfm from 'remark-gfm';
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'], // Support MDX pages
experimental: {
outputFileTracingIncludes: {
'/articles/*': ['./src/app/articles/**/*.mdx'], // Include MDX files in builds
},
},
eslint: {
ignoreDuringBuilds: true, // Allow builds to proceed even if there are ESLint warnings/errors
},
webpack: (config) => {
config.resolve.alias['@'] = `${__dirname}/src`; // Update alias with ESM-compatible path resolution
config.cache = false; // Disables Webpack persistent caching to address caching-related errors
return config;
},
};
// MDX plugin configuration with GitHub-flavored Markdown and Prism syntax highlighting
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkGfm], // GitHub-flavored Markdown support for MDX files
rehypePlugins: [rehypePrism], // Adds syntax highlighting with Prism.js
},
});
export default withMDX(nextConfig);