Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby-image generates images for unused components #26561

Closed
vsolanogo opened this issue Aug 20, 2020 · 4 comments
Closed

gatsby-image generates images for unused components #26561

vsolanogo opened this issue Aug 20, 2020 · 4 comments
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@vsolanogo
Copy link

vsolanogo commented Aug 20, 2020

to improve development start time sometimes i remove all the pages in page folder expect one i will work on, i expect that gatsby image will render images only for those components that it used in that page.js file and its children, but it doesn't, gatsby will render same amount of images, same size of images as it was all pages anyway

Expected result

don't generate images with gatsby image for unused components

Actual result

doesn't matter whether you develop with just single file in page folder (meaninig you deloping only 1 page) or 50 gatsby-image will generate all the images into public folder

@vsolanogo vsolanogo added the type: bug An issue or pull request relating to a bug in Gatsby label Aug 20, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 20, 2020
@polarathene
Copy link
Contributor

Did you clear out any cache? gatsby clean should work. If you are referring to image graphql queries, I'm not sure how that's handled, but the JS side for gatsby-image components should not be built or included in your bundle. The graphql queries are run at build time triggering the image processing, none of that matters for deployment.

What you want is being tracked here. Unrelated to gatsby-image components.

@vsolanogo
Copy link
Author

Did you clear out any cache? gatsby clean should work. If you are referring to image graphql queries, I'm not sure how that's handled, but the JS side for gatsby-image components should not be built or included in your bundle. The graphql queries are run at build time triggering the image processing, none of that matters for deployment.

What you want is being tracked here. Unrelated to gatsby-image components.

of course, i always clear cache

@polarathene
Copy link
Contributor

Clearing the cache will require processing all images again. When developing you can just use gatsby develop and only need to run gatsby clean if something seems broken.

Subscribe to the issue I linked you to, that is what you're wanting for the most part, to avoid unnecessary image processing while developing.

For now you can comment out the graphql queries that you don't want to run, and that will skip them.

@blainekasten
Copy link
Contributor

Closing as duplicate of #24822

@blainekasten blainekasten removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants