diff --git a/.changeset/fair-otters-worry.md b/.changeset/fair-otters-worry.md new file mode 100644 index 0000000000..f62496140b --- /dev/null +++ b/.changeset/fair-otters-worry.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Improve error message when user attempts to render a dynamic component reference diff --git a/packages/astro/src/runtime/server/hydration.ts b/packages/astro/src/runtime/server/hydration.ts index e9d99c81a7..09f42a9b5c 100644 --- a/packages/astro/src/runtime/server/hydration.ts +++ b/packages/astro/src/runtime/server/hydration.ts @@ -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 = {