ホーム > Gatsby > How to Fix Gatsby.js StaticImage Not Updating
Gatsby

How to Fix Gatsby.js StaticImage Not Updating

Thank you for your continued support.
This article contains advertisements that help fund our operations.

⇨ Table of Contents for React Articles

This article explains how to fix the issue when Gatsby's StaticImage doesn't update.

Introduction

When using gatsby-plugin-image:

<StaticImage src="path" alt="" />

Even after changing the src, the image does not update. This article addresses that issue.

gatsby-plugin-image

Solution

Clear the Cache

When you change an image but keep the same filename, Gatsby sometimes doesn’t switch the images properly.

In such cases, deleting the cache and regenerating the site should fix the problem.

gatsby clean
gatsby develop

After regenerating, the image should be displayed correctly.

Conclusion

That's it! I hope this helps someone.

→ Read more about using gatsby-plugin-images in this article

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!