From 5b6173fd031b7e85974cbadd39de7fa199075e44 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:55:06 -0300 Subject: [PATCH] Add an error message for improperly configured renderers (#4705) * Add error messages for wrongly configured renderers * Add changeset --- .changeset/fuzzy-rats-remain.md | 5 +++++ packages/astro/src/integrations/index.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/fuzzy-rats-remain.md diff --git a/.changeset/fuzzy-rats-remain.md b/.changeset/fuzzy-rats-remain.md new file mode 100644 index 0000000000..601d2483b8 --- /dev/null +++ b/.changeset/fuzzy-rats-remain.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Properly show an error message when a renderer is not properly configured diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index ba9cac2c8b..68d2a23aef 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -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) => {