fix(cloudflare): remove worker output for fully static sites#15478
fix(cloudflare): remove worker output for fully static sites#15478
Conversation
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 detectedLatest 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 |
|
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 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
See the adapter: The build worker based on examples from Cloudflare: 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. |
Changes
_worker.jsdirectoryastro:routes:resolved_worker.jsdirectory inastro:build:donefor static sitesstaticOutputadapter support from'unsupported'to'stable'Testing
packages/integrations/cloudflare/test/fixtures/static/with a fully static sitestatic.test.jsthat verifies_worker.jsdirectory is not present after buildDocs
No docs changes needed - this is a bug fix that makes static sites work as expected without generating unnecessary server code.