Skip to content

Commit

Permalink
fix(astro): Pre-bundle client dependency for exported control compone…
Browse files Browse the repository at this point in the history
…nts (#4131)
  • Loading branch information
wobsoriano authored Sep 10, 2024
1 parent 8c6909d commit 4020ead
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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');
},
load(id) {
if (id === resolvedVirtualModuleId) {
return `
Expand Down

0 comments on commit 4020ead

Please sign in to comment.