fix: improve plugin import error (#1674)

This commit is contained in:
Roman Hotsiy
2024-08-22 15:33:21 +08:00
committed by GitHub
parent 295e98faaf
commit bb0553bc51
2 changed files with 6 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---
Get more helpful error messages when there's a problem importing a plugin.

View File

@@ -155,10 +155,7 @@ export async function resolvePlugins(
return mod.default || mod;
}
} catch (e) {
if (e instanceof SyntaxError) {
throw e;
}
throw new Error(`Failed to load plugin "${plugin}". Please provide a valid path`);
throw new Error(`Failed to load plugin "${plugin}": ${e.message}\n\n${e.stack}`);
}
}