@@ -312,34 +312,38 @@ export const renderHTMLProd = async ({
312312 }
313313 }
314314
315- await Bluebird . map ( paths , async pagePath => {
316- try {
317- const pageData = await readPageData ( publicDir , pagePath )
318- const resourcesForTemplate = await getResourcesForTemplate ( pageData )
319-
320- const { html, unsafeBuiltinsUsage } = htmlComponentRenderer . default ( {
321- pagePath,
322- pageData,
323- ...resourcesForTemplate ,
324- } )
325-
326- if ( unsafeBuiltinsUsage . length > 0 ) {
327- unsafeBuiltinsUsageByPagePath [ pagePath ] = unsafeBuiltinsUsage
328- }
329-
330- return fs . outputFile ( getPageHtmlFilePath ( publicDir , pagePath ) , html )
331- } catch ( e ) {
332- if ( e . unsafeBuiltinsUsage && e . unsafeBuiltinsUsage . length > 0 ) {
333- unsafeBuiltinsUsageByPagePath [ pagePath ] = e . unsafeBuiltinsUsage
334- }
335- // add some context to error so we can display more helpful message
336- e . context = {
337- path : pagePath ,
338- unsafeBuiltinsUsageByPagePath,
315+ await Bluebird . map (
316+ paths ,
317+ async pagePath => {
318+ try {
319+ const pageData = await readPageData ( publicDir , pagePath )
320+ const resourcesForTemplate = await getResourcesForTemplate ( pageData )
321+
322+ const { html, unsafeBuiltinsUsage } = htmlComponentRenderer . default ( {
323+ pagePath,
324+ pageData,
325+ ...resourcesForTemplate ,
326+ } )
327+
328+ if ( unsafeBuiltinsUsage . length > 0 ) {
329+ unsafeBuiltinsUsageByPagePath [ pagePath ] = unsafeBuiltinsUsage
330+ }
331+
332+ return fs . outputFile ( getPageHtmlFilePath ( publicDir , pagePath ) , html )
333+ } catch ( e ) {
334+ if ( e . unsafeBuiltinsUsage && e . unsafeBuiltinsUsage . length > 0 ) {
335+ unsafeBuiltinsUsageByPagePath [ pagePath ] = e . unsafeBuiltinsUsage
336+ }
337+ // add some context to error so we can display more helpful message
338+ e . context = {
339+ path : pagePath ,
340+ unsafeBuiltinsUsageByPagePath,
341+ }
342+ throw e
339343 }
340- throw e
341- }
342- } )
344+ } ,
345+ { concurrency : 2 }
346+ )
343347
344348 return { unsafeBuiltinsUsageByPagePath }
345349}
@@ -372,18 +376,25 @@ export const renderHTMLDev = async ({
372376 lastSessionId = sessionId
373377 }
374378
375- return Bluebird . map ( paths , async pagePath => {
376- try {
377- const htmlString = htmlComponentRenderer . default ( {
378- pagePath,
379- } )
380- return fs . outputFile ( getPageHtmlFilePath ( outputDir , pagePath ) , htmlString )
381- } catch ( e ) {
382- // add some context to error so we can display more helpful message
383- e . context = {
384- path : pagePath ,
379+ return Bluebird . map (
380+ paths ,
381+ async pagePath => {
382+ try {
383+ const htmlString = htmlComponentRenderer . default ( {
384+ pagePath,
385+ } )
386+ return fs . outputFile (
387+ getPageHtmlFilePath ( outputDir , pagePath ) ,
388+ htmlString
389+ )
390+ } catch ( e ) {
391+ // add some context to error so we can display more helpful message
392+ e . context = {
393+ path : pagePath ,
394+ }
395+ throw e
385396 }
386- throw e
387- }
388- } )
397+ } ,
398+ { concurrency : 2 }
399+ )
389400}
0 commit comments