From 9c0789878b35cb407b5f059fe0b8392430e72879 Mon Sep 17 00:00:00 2001 From: itowlson Date: Tue, 11 Dec 2018 09:32:13 +1300 Subject: [PATCH] Support loading full bundles from file paths (#50) --- app/utils/embedded.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/utils/embedded.ts b/app/utils/embedded.ts index 839c94d..4f0a0e7 100644 --- a/app/utils/embedded.ts +++ b/app/utils/embedded.ts @@ -64,8 +64,13 @@ async function loadFullBundle(): Promise<{} | undefined> { if (!bundleUrl) { return undefined; } - const bundleContent = await request.get(bundleUrl, { encoding: null }); - return bundleContent; + if (bundleUrl.startsWith('http')) { + const bundleContent = await request.get(bundleUrl, { encoding: null }); + return bundleContent; + } else { + const bundleContent = await fs.readFile(bundleUrl); + return bundleContent; + } } export async function hasFullBundle(): Promise {