withastro / adapters

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

fix(netlify): externalise sharp when bundling edge middleware #316

Closed ascorbic closed 1 week ago

ascorbic commented 1 week ago

Changes

Astro 4.11 had a regression that caused edge middleware bundling to fail on Netlify in some situations. This seems to have been a side effect of something being imported into middleware that used astro:assets, which meant that sharp became a dependency. Sharp uses lots of node builtins, which aren't compatible with middleware, so builds were failing.

This PR sets sharp to "external", ensuring it's never bundled. In future we should think about ways to avoid these kinds of cross-runtime imports happening.

Testing

A test was failing that is now fixed

Docs

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 87e6eb697124b82f2f203577cc4986773d86da41

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

This PR includes changesets to release 2 packages | Name | Type | | ---------------------------------- | ----- | | @astrojs/netlify | Patch | | @test/netlify-hosted-astro-project | Patch |

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