withastro / adapters

Home for Astro's core maintained adapters
47 stars 26 forks source link

Cloudflare v10 breaks cloudflare build with hybrid output #244

Closed terenced closed 2 months ago

terenced commented 2 months ago

Astro Info

Astro                    v4.6.3
Node                     v18.18.0
System                   Linux (x64)
Package Manager          npm
Output                   hybrid
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/mdx
                         @astrojs/sitemap

Describe the Bug

When using v10 version of the adapter, hybrid output mode breaks when building (local and on Cloudflare) for a basic blog with an endpoint.

Steps to reproduce Simple Astro blog with cloudflare adapter with output set to hybrid. npm install npm build

ENOENT: no such file or directory, unlink '/home/projects/withastro-astro-zvterw/dist/_worker.js/chunks/HeaderLink_astro_astro_type_style_index_0_lang.6f5a13b1_CPdNtWCo.mjs'

What's the expected result?

Should be able to build in hybrid mode.

What I think is happening

When the build is complete, the adapter tries to remove the temporary files, but fails because the file no longer exits. In the linked stackblitz, it seems to trying to clean up CSS file, and in my own project, it is a file related to tailwind.css.

What I suspect is happening is when NonServerChunkDetector's processBundle is executed, the bundle includes unbundled css files that Vite has not bundled yet. Then the adapter tries to remove the file, it is already deleted my Vite.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-zvterw

Participation