Skip to content

fix(theme): ship component scripts as files, not inline - #11

Merged
Madraka merged 1 commit into
mainfrom
fix/lens-script-csp
Oct 21, 2026
Merged

Madraka merged 1 commit into
mainfrom
fix/lens-script-csp

Conversation

@Madraka

@Madraka Madraka commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

The live site Worker sends Content-Security-Policy: script-src 'self'. Astro inlines a component <script> smaller than 4 KB, and the lens hero's script is about 3 KB. On the live home page it was inlined, the browser blocked it (console: "Executing inline script violates … script-src 'self'"), and the lens stood still. It was static but not broken.

vite.build.assetsInlineLimit is now a function that returns false for .js, so scripts always ship as files under /_astro/. Other assets keep Astro's default.

Checked with a CLOUDHAL_TARGET=cloudflare astro build: the script is emitted as dist/client/_astro/LensHero.astro_astro_type_script_index_0_lang.*.js, and no inline lens code is left in the server bundle.

🤖 Generated with Claude Code

The site Worker sends Content-Security-Policy: script-src 'self', and Astro
inlines a component <script> under 4 KB. The lens hero's script (~3 KB) was
inlined on the live home page and blocked, so the lens stood still. Scripts now
always ship as files under /_astro; other assets keep Astro's default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
cloudhal-com-site cc0fb62 Oct 21 2026, 08:23 PM

@Madraka
Madraka merged commit 26c407c into main Oct 21, 2026
3 checks passed
@Madraka
Madraka deleted the fix/lens-script-csp branch October 21, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant