From 39939d472d0d250a148066066277976e496d087a Mon Sep 17 00:00:00 2001 From: Matthew Hatcher <3768988+MatthewSH@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:28:21 -0600 Subject: [PATCH] fix: await importDirectory call (#2770) await importDirectory to ensure all recursive calls inside the function are completed before calling fileLoader --- plugins/fileloader/mod.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/fileloader/mod.ts b/plugins/fileloader/mod.ts index eef8ad476..8602b878f 100644 --- a/plugins/fileloader/mod.ts +++ b/plugins/fileloader/mod.ts @@ -55,12 +55,11 @@ export async function fastFileLoader( before?: (uniqueFilePathCounter: number, paths: string[]) => void, ) { await Promise.all( - [...paths].map((path) => { + [...paths].map(async (path) => { if (between) between(path, uniqueFilePathCounter, paths); - importDirectory(path); + await importDirectory(path); }), ); - if (before) before(uniqueFilePathCounter, paths); await fileLoader();