Skip to content

Commit

Permalink
fix(#8746): improve error message for dynamic component usage (#8747)
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored Oct 4, 2023
1 parent aa265d7 commit d78806d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-otters-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Improve error message when user attempts to render a dynamic component reference
7 changes: 4 additions & 3 deletions packages/astro/src/runtime/server/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ export async function generateHydrateScript(
const { hydrate, componentUrl, componentExport } = metadata;

if (!componentExport.value) {
throw new Error(
`Unable to resolve a valid export for "${metadata.displayName}"! Please open an issue at https://astro.build/issues!`
);
throw new AstroError({
...AstroErrorData.NoMatchingImport,
message: AstroErrorData.NoMatchingImport.message(metadata.displayName),
});
}

const island: SSRElement = {
Expand Down

0 comments on commit d78806d

Please sign in to comment.