Skip to content

Commit

Permalink
Disable sharp libvips cache. (#10616)
Browse files Browse the repository at this point in the history
* Disable `sharp` `libvips` cache.

* Update sharp.ts

* Add changeset

* Apply suggestions from code review

* Add issue to comment in sharp.ts

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
  • Loading branch information
NikolaRHristov and ematipico committed Apr 3, 2024
1 parent 8db630c commit 317d18e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/thin-seahorses-whisper.md
@@ -0,0 +1,7 @@
---
"astro": patch
---

This change disables the `sharp` `libvips` image cache as it errors when the
file is too small and operations are happening too fast (runs into a race
condition)
3 changes: 3 additions & 0 deletions packages/astro/src/assets/services/sharp.ts
Expand Up @@ -32,6 +32,9 @@ async function loadSharp() {
throw new AstroError(AstroErrorData.MissingSharp);
}

// Disable the `sharp` `libvips` cache as it errors when the file is too small and operations are happening too fast (runs into a race condition) https://github.com/lovell/sharp/issues/3935#issuecomment-1881866341
sharpImport.cache(false);

return sharpImport;
}

Expand Down

0 comments on commit 317d18e

Please sign in to comment.