@@ -159,7 +159,9 @@ async function runNextPrerenderUrl(config: d.Config, compilerCtx: d.CompilerCtx,
159159
160160 hydrateResults . push ( results ) ;
161161
162- await writePrerenderDest ( config , compilerCtx , outputTarget , results ) ;
162+ if ( results . diagnostics == null || results . diagnostics . length === 0 ) {
163+ await writePrerenderDest ( config , compilerCtx , outputTarget , results ) ;
164+ }
163165
164166 } catch ( e ) {
165167 // darn, idk, bad news
@@ -176,14 +178,16 @@ async function runNextPrerenderUrl(config: d.Config, compilerCtx: d.CompilerCtx,
176178
177179
178180async function writePrerenderDest ( config : d . Config , compilerCtx : d . CompilerCtx , outputTarget : d . OutputTargetWww , results : d . HydrateResults ) {
179- // create the full path where this will be saved
180- const filePath = getWritePathFromUrl ( config , outputTarget , results . url ) ;
181+ if ( typeof results . url === 'string' && typeof results . html === 'string' ) {
182+ // create the full path where this will be saved
183+ const filePath = getWritePathFromUrl ( config , outputTarget , results . url ) ;
181184
182- // add the prerender html content it to our collection of
183- // files that need to be saved when we're all ready
184- await compilerCtx . fs . writeFile ( filePath , results . html , { useCache : false } ) ;
185+ // add the prerender html content it to our collection of
186+ // files that need to be saved when we're all ready
187+ await compilerCtx . fs . writeFile ( filePath , results . html , { useCache : false } ) ;
185188
186- // write the files now
187- // and since we're not using cache it'll free up its memory
188- await compilerCtx . fs . commit ( ) ;
189+ // write the files now
190+ // and since we're not using cache it'll free up its memory
191+ await compilerCtx . fs . commit ( ) ;
192+ }
189193}
0 commit comments