You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To experiment with this, I installed gatsby-plugin-sharp but did not add it as a plugin to Gatsby, then added gatsby-remark-images as a plugin and everything worked as expected.
So this poses two questions:
Is gatsby-plugin-sharp actually a plugin? Or is it a utility package that other plugins rely on?
Given that both gatsby-transformer-sharp and gatsby-remark-images work without gatsby-plugin-sharp being added as a plugin, would it make more sense to add it as a dependency to both for an easier setup?
The text was updated successfully, but these errors were encountered:
Had an offline conversation with @KyleAMathews that clarified this.
gatsby-plugin-sharp manages a job queue that tells the Gatsby bootstrap process when it's complete
It's possible to run without this reporting, but likely that problems will occur at some point.
There is an idea (see Add a generic jobs logging framework to the Gatsby core to allow custom plugin logging #4299) to move this job queue/reporting into the core, which would eliminate the dependency on gatsby-plugin-sharp for other plugins — instead, the logic would be moved into a utility package (e.g. gatsby-sharp) that would not need to be added as a Gatsby plugin.
For now, gatsby-plugin-sharp should be a peerDependency of both gatsby-remark-images and gatsby-transformer-sharp and MUST be declared in the gatsby-config.js plugin array.
Looking deeper into #3545, it looks like things are a little weirder than I initially thought.
I do have
gatsby-plugin-sharp
installed as a dependency in my site, but not included in the plugin array insidegatsby-config.js
.My guess is that this doesn't fail because
gatsby-transformer-sharp
is directly importing what it needs, as isgatsby-remark-images
.Currently,
gatsby-plugin-sharp
is a direct dependency ofgatsby-remark-images
and not referenced at all ingatsby-transformer-sharp
.To experiment with this, I installed
gatsby-plugin-sharp
but did not add it as a plugin to Gatsby, then addedgatsby-remark-images
as a plugin and everything worked as expected.So this poses two questions:
gatsby-plugin-sharp
actually a plugin? Or is it a utility package that other plugins rely on?gatsby-transformer-sharp
andgatsby-remark-images
work withoutgatsby-plugin-sharp
being added as a plugin, would it make more sense to add it as a dependency to both for an easier setup?The text was updated successfully, but these errors were encountered: