Images missing in production build, based on local presence of ".cache" or "public" folders #27691
Replies: 4 comments 2 replies
-
This is a known problem — @vladar has been doing some work to validate the state of these folders — #27549 Can you check if this fixes your reproduction? |
Beta Was this translation helpful? Give feedback.
-
Or in other words: This is expected behavior. You'll need to keep both folders around when building or when deleting things you'll need to delete both. |
Beta Was this translation helpful? Give feedback.
-
Can you try it on the latest gatsby ( |
Beta Was this translation helpful? Give feedback.
-
You are right! This happens because sharp job results are not purged even after we purge the cache directory and redux state. Created a new issue from this discussion: #27699 Let's track it there. |
Beta Was this translation helpful? Give feedback.
-
Description
I've encountered a weird error where gatsby is not building images in production. This behaviour is based on the local state of .cache & public folders - if one of them is missing, then the resulting build contains no images.
Steps to reproduce
I've created a repository with minimal steps to reproduce: https://github.com/jakubjafra/gatsby-image-build-error
It's a basic gatsby example, with just an image added using
gatsby-image
.Basic example:
Expected result
Images should be present in a production build.
Actual result
Images are not optimized and thus not bundled in the production build. The URLs are built, however, and return 404 HTML page.
Environment
(I've also tested this on Node v15.0.1)
Beta Was this translation helpful? Give feedback.
All reactions