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;