From ff7f671c79f5dcdc44e4319a10f3654e12662c23 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 12 Jan 2025 05:01:28 +1100 Subject: [PATCH] fix: Push adapter not loading on some versions of Node 22 (#9524) --- src/Adapters/AdapterLoader.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Adapters/AdapterLoader.js b/src/Adapters/AdapterLoader.js index 5d9d9b0332..aa40162cd0 100644 --- a/src/Adapters/AdapterLoader.js +++ b/src/Adapters/AdapterLoader.js @@ -47,20 +47,8 @@ export function loadAdapter(adapter, defaultAdapter, options): T { } export async function loadModule(modulePath) { - let module; - try { - module = require(modulePath); - } catch (err) { - if (err.code === 'ERR_REQUIRE_ESM') { - module = await import(modulePath); - if (module.default) { - module = module.default; - } - } else { - throw err; - } - } - return module; + const module = await import(modulePath); + return module?.default || module; } export default loadAdapter;