Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Push adapter not loading on some versions of Node 22 #9524

Merged
merged 14 commits into from
Jan 11, 2025
16 changes: 2 additions & 14 deletions src/Adapters/AdapterLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,8 @@ export function loadAdapter<T>(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;
Loading