1+ // next.config.ts
12// File path: next.config.ts
23// Configures Next.js for K12Beast, including MDX support for documentation pages
34// Allows external image domains for testing and Supabase storage URLs
45// Disables TypeScript build errors and source maps in development
56// Sets cache control headers for source maps
6- // Configures MDX to strip comments and frontmatter from rendering , with GFM support for tables
7+ // Configures MDX to strip comments and frontmatter, with GFM support for tables
78
89import type { NextConfig } from 'next' ;
910import createMDX from '@next/mdx' ;
1011import remarkFrontmatter from 'remark-frontmatter' ;
11- import remarkGfm from 'remark-gfm' ; // Added for GFM table support
12+ import remarkGfm from 'remark-gfm' ;
1213import remarkRemoveComments from 'remark-remove-comments' ;
1314import { remove } from 'unist-util-remove' ;
1415
1516// Custom remark plugin to remove frontmatter node from the MDX AST
1617function remarkRemoveFrontmatter ( ) {
1718 return ( tree : any ) => {
18- remove ( tree , { type : 'yaml' } ) ; // Remove frontmatter (yaml node)
19+ remove ( tree , { type : 'yaml' } ) ;
1920 return tree ;
2021 } ;
2122}
2223
2324const nextConfig : NextConfig = {
2425 productionBrowserSourceMaps : false ,
2526 typescript : {
26- ignoreBuildErrors : true , // Disable TypeScript errors during build
27+ ignoreBuildErrors : true ,
2728 } ,
2829 images : {
29- domains : [ 'mockurl.com' ] , // For tests
30+ domains : [ 'mockurl.com' ] ,
3031 remotePatterns : [
3132 {
3233 protocol : 'https' ,
33- hostname : '*.supabase.co' , // Allow any subdomain of supabase.co
34- port : '' , // Leave empty for default ports (80, 443)
35- pathname : '/storage/v1/object/public/**' , // Match Supabase storage paths
34+ hostname : '*.supabase.co' ,
35+ port : '' ,
36+ pathname : '/storage/v1/object/public/**' ,
3637 } ,
3738 ] ,
3839 } ,
3940 webpack : ( config , { dev } ) => {
4041 if ( dev ) {
41- config . devtool = false ; // Disable source maps in dev mode
42+ config . devtool = false ;
4243 }
4344 return config ;
4445 } ,
@@ -55,18 +56,17 @@ const nextConfig: NextConfig = {
5556 } ,
5657 ] ;
5758 } ,
58- pageExtensions : [ 'js' , 'jsx' , 'ts' , 'tsx' , 'md' , 'mdx' ] , // Enable MDX pages
59+ pageExtensions : [ 'js' , 'jsx' , 'ts' , 'tsx' , 'md' , 'mdx' ] ,
5960} ;
6061
6162const withMDX = createMDX ( {
6263 options : {
6364 remarkPlugins : [
64- remarkFrontmatter , // Parse frontmatter
65- remarkRemoveFrontmatter , // Remove frontmatter from rendering
66- remarkRemoveComments , // Remove comments (e.g., lines starting with //)
67- remarkGfm , // Enable GitHub Flavored Markdown for table support,
65+ remarkFrontmatter ,
66+ remarkRemoveFrontmatter ,
67+ remarkRemoveComments ,
68+ remarkGfm ,
6869 ] ,
69- // Add rehype plugins here if needed in the future
7070 rehypePlugins : [ ] ,
7171 } ,
7272} ) ;
0 commit comments