fix: client:only behavior with a single renderer (#1959)

This commit is contained in:
Nate Moore 2021-11-22 07:47:26 -06:00 committed by GitHub
parent 8775730eb9
commit aec4e8da27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix client:only behavior when only a single renderer is configured

View file

@ -168,6 +168,10 @@ Did you mean to enable ${formatList(probableRendererNames.map((r) => '`' + r + '
const rendererName = metadata.hydrateArgs;
renderer = renderers.filter(({ name }) => name === `@astrojs/renderer-${rendererName}` || name === rendererName)[0];
}
// Attempt: user only has a single renderer, default to that
if (!renderer && renderers.length === 1) {
renderer = renderers[0]
}
// Attempt: can we guess the renderer from the export extension?
if (!renderer) {
const extname = metadata.componentUrl?.split('.').pop();