Catch if plugins aren't found globally (#4452)

This commit is contained in:
Peter Hedenskog 2025-02-28 04:24:17 +01:00 committed by GitHub
parent 06fb437625
commit b0a98cc973
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 6 deletions

View File

@ -81,12 +81,18 @@ export async function loadPlugins(pluginNames, options, context, queue) {
plugins.push(p); plugins.push(p);
} catch (error) { } catch (error) {
// try global // try global
let { default: plugin } = await importGlobalSilent(name); try {
if (plugin) { let { default: plugin } = await importGlobalSilent(name);
let p = new plugin(options, context, queue); if (plugin) {
plugins.push(p); let p = new plugin(options, context, queue);
} else { plugins.push(p);
console.error("Couldn't load plugin %s: %s", name, error_); } else {
console.error("Couldn't load plugin %s: %s", name, error_);
// if it fails here, let it fail hard
throw error;
}
} catch {
console.error("Couldn't find/load plugin %s", name);
// if it fails here, let it fail hard // if it fails here, let it fail hard
throw error; throw error;
} }