File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,9 @@ export async function getStaticPaths() {
139139 const stat = promisify ( fs . stat ) ;
140140 const rootDir = process . cwd ( ) + '/src/content' ;
141141
142+ // Pages that should only be available in development.
143+ const devOnlyPages = new Set ( [ 'learn/rsc-sandbox-test' ] ) ;
144+
142145 // Find all MD files recursively.
143146 async function getFiles ( dir ) {
144147 const subdirs = await readdir ( dir ) ;
@@ -170,14 +173,20 @@ export async function getStaticPaths() {
170173
171174 const files = await getFiles ( rootDir ) ;
172175
173- const paths = files . map ( ( file ) => ( {
174- params : {
175- markdownPath : getSegments ( file ) ,
176- // ^^^ CAREFUL HERE.
177- // If you rename markdownPath, update patches/next-remote-watch.patch too.
178- // Otherwise you'll break Fast Refresh for all MD files.
179- } ,
180- } ) ) ;
176+ const paths = files
177+ . map ( ( file ) => ( {
178+ params : {
179+ markdownPath : getSegments ( file ) ,
180+ // ^^^ CAREFUL HERE.
181+ // If you rename markdownPath, update patches/next-remote-watch.patch too.
182+ // Otherwise you'll break Fast Refresh for all MD files.
183+ } ,
184+ } ) )
185+ . filter ( ( entry ) => {
186+ if ( process . env . NODE_ENV !== 'production' ) return true ;
187+ const pagePath = entry . params . markdownPath . join ( '/' ) ;
188+ return ! devOnlyPages . has ( pagePath ) ;
189+ } ) ;
181190
182191 return {
183192 paths : paths ,
You can’t perform that action at this time.
0 commit comments