Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

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

Merged
ascorbic merged 2 commits intomainfrom
plt-2265
Jul 1, 2024
Merged

fix(netlify): externalise sharp when bundling edge middleware#316
ascorbic merged 2 commits intomainfrom
plt-2265

Conversation

@ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jul 1, 2024

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
Copy link

changeset-bot bot commented Jul 1, 2024

🦋 Changeset detected

Latest commit: 87e6eb6

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

@ascorbic ascorbic merged commit d81806a into main Jul 1, 2024
@github-actions github-actions bot mentioned this pull request Jul 1, 2024
@alexanderniebuhr alexanderniebuhr deleted the plt-2265 branch August 6, 2024 11:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants