Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thirty-hotels-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/astro": patch
---

Fixes an issue where control components in client-side rendered apps are always hidden.
7 changes: 7 additions & 0 deletions packages/astro/src/integration/vite-plugin-astro-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ export function vitePluginAstroConfig(astroConfig: AstroConfig): VitePlugin {
return resolvedVirtualModuleId;
}
},
config(config) {
// While Astro processes <script> tags by default, our control components
// which uses <script> tags and imports nanostores will not be processed by Astro.
// This ensures @clerk/astro/client is properly processed and bundled,
// resolving runtime import issues in these components.
config.optimizeDeps?.include?.push('@clerk/astro/client');
Copy link
Member Author

@wobsoriano wobsoriano Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More info on how Astro processes <script> tags here.

The @clerk/astro/client export is imported by our control components, but Astro is not able to process it. Adding it to optimizeDeps.include will force astro to process it.

},
load(id) {
if (id === resolvedVirtualModuleId) {
return `
Expand Down