fix(#8746): improve error message for dynamic component usage (#8747)

This commit is contained in:
Nate Moore 2023-10-04 15:07:21 -05:00 committed by GitHub
parent aa265d7302
commit d78806dfe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Improve error message when user attempts to render a dynamic component reference

View file

@ -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 = {