Add an error message for improperly configured renderers (#4705)

* Add error messages for wrongly configured renderers

* Add changeset
This commit is contained in:
Erika 2022-09-12 11:55:06 -03:00 committed by GitHub
parent ee03967f92
commit 5b6173fd03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Properly show an error message when a renderer is not properly configured

View file

@ -66,6 +66,14 @@ export async function runHookConfigSetup({
config: updatedConfig,
command,
addRenderer(renderer: AstroRenderer) {
if (!renderer.name) {
throw new Error(`Integration ${bold(integration.name)} has an unnamed renderer.`);
}
if (!renderer.serverEntrypoint) {
throw new Error(`Renderer ${bold(renderer.name)} does not provide a serverEntrypoint.`);
}
updatedConfig._ctx.renderers.push(renderer);
},
injectScript: (stage, content) => {