Skip to content

Commit 183f522

Browse files
committed
fix push adapter on node 22
1 parent c604464 commit 183f522

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/Adapters/AdapterLoader.js

+2-14
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,8 @@ export function loadAdapter<T>(adapter, defaultAdapter, options): T {
4747
}
4848

4949
export async function loadModule(modulePath) {
50-
let module;
51-
try {
52-
module = require(modulePath);
53-
} catch (err) {
54-
if (err.code === 'ERR_REQUIRE_ESM') {
55-
module = await import(modulePath);
56-
if (module.default) {
57-
module = module.default;
58-
}
59-
} else {
60-
throw err;
61-
}
62-
}
63-
return module;
50+
const module = await import(modulePath);
51+
return module?.default || module;
6452
}
6553

6654
export default loadAdapter;

0 commit comments

Comments
 (0)