From 7f48b349e25ac795d57328bebda757fab9bf38e3 Mon Sep 17 00:00:00 2001 From: Andre Schneider Date: Thu, 18 Sep 2025 17:14:12 +0200 Subject: [PATCH] fallback to esm loading when top level await is causing issues --- lib/env/migrationsDir.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/env/migrationsDir.js b/lib/env/migrationsDir.js index 906234c..2447701 100644 --- a/lib/env/migrationsDir.js +++ b/lib/env/migrationsDir.js @@ -102,7 +102,7 @@ module.exports = { const result = moduleLoader.require(migrationPath); return getModuleExports(result); } catch (e) { - if (e.code === 'ERR_REQUIRE_ESM') { + if (e.code === 'ERR_REQUIRE_ESM' || e.code === 'ERR_REQUIRE_ASYNC_MODULE') { const loadedImport = moduleLoader.import(url.pathToFileURL(migrationPath)); return getModuleExports(loadedImport); }