Skip to content

fix(cloudflare): remove worker output for fully static sites#15478

Merged
matthewp merged 4 commits intomainfrom
cf-static-worker-bug
Feb 12, 2026
Merged

fix(cloudflare): remove worker output for fully static sites#15478
matthewp merged 4 commits intomainfrom
cf-static-worker-bug

Conversation

@matthewp
Copy link
Contributor

Changes

  • Fully static Cloudflare sites no longer output unnecessary _worker.js directory
  • Detects fully static sites by checking if all non-internal routes are prerendered in astro:routes:resolved
  • Removes _worker.js directory in astro:build:done for static sites
  • Changes staticOutput adapter support from 'unsupported' to 'stable'

Testing

  • Added new test fixture packages/integrations/cloudflare/test/fixtures/static/ with a fully static site
  • Added static.test.js that verifies _worker.js directory is not present after build
  • All existing Cloudflare tests pass

Docs

No docs changes needed - this is a bug fix that makes static sites work as expected without generating unnecessary server code.

When all non-internal routes are prerendered, the _worker.js directory
is now removed from the build output since it's not needed for static
deployments.

- Detect fully static sites in astro:routes:resolved
- Remove _worker.js directory in astro:build:done for static sites
- Change staticOutput support from 'unsupported' to 'stable'
- Add test fixture and test for static output
@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2026

🦋 Changeset detected

Latest commit: ef1e700

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Feb 11, 2026
@matthewp matthewp marked this pull request as ready for review February 11, 2026 22:11
@matthewp matthewp merged commit ee519e5 into main Feb 12, 2026
23 checks passed
@matthewp matthewp deleted the cf-static-worker-bug branch February 12, 2026 13:32
@mikepage
Copy link

mikepage commented Feb 18, 2026

Hi @matthewp

When I was working on the build pipeline for multi-tenant astro projects with Cloudflare Workers for Platforms I noticed the worker entry file went gone when building static with the updated @astrojs/cloudflare@13.0.0-beta.8 adapter.

Cloudflare Workers for Platforms requires a minimal module to serve static assets, similar to the module we got in the build output.

I wrote an adapter for Cloudflare Worker for Platforms to always generate this module and
add a fix where assets are served without content type (inspired by https://github.com/cloudflare/vibesdk/)

Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module
scripts per HTML spec.

See the adapter:
https://github.com/mikepage/astro-workers-for-platforms-example-theme/blob/main/adapter.mjs

The build worker based on examples from Cloudflare:
https://github.com/mikepage/astro-workers-for-platforms-example-build-worker/

Do you think a minimal adapter like this is nice for deploying multi-tenant, or should we just make some code use server to generate the server endpoint. Then we just need to fix the Content-Type header issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments