feat: Upgrade to @parse/push-adapter 6.4.0 (#9182)

This commit is contained in:
Diamond Lewis
2024-07-08 15:23:57 -05:00
committed by GitHub
parent e7199e8d07
commit ef1634bf1f
6 changed files with 203 additions and 234 deletions

View File

@@ -46,4 +46,21 @@ export function loadAdapter<T>(adapter, defaultAdapter, options): T {
return adapter;
}
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;
}
export default loadAdapter;