From a1648345c84b8bccdc92f534b07cff317a3564cd Mon Sep 17 00:00:00 2001 From: Brian Takita Date: Mon, 13 May 2019 00:14:59 -0400 Subject: [PATCH] Waiting for all requests to finish before closing q. Fixes https://github.com/sveltejs/sapper/issues/689 --- src/api/export.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/export.ts b/src/api/export.ts index 1d6a718d0..4dac68b1d 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -173,7 +173,7 @@ async function _export({ let match; let pattern = //gm; - let promise; + const promises = []; while (match = pattern.exec(cleaned)) { const attrs = match[1]; @@ -183,12 +183,12 @@ async function _export({ const url = resolve(base.href, href); if (url.protocol === protocol && url.host === host) { - promise = handle(url); + promises.push(handle(url)); } } } - await promise; + await Promise.all(promises); } } }