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

chore(gatsby-plugin-image): Add peerDependenciesMeta #35146

Merged
merged 3 commits into from Nov 24, 2022
Merged

chore(gatsby-plugin-image): Add peerDependenciesMeta #35146

merged 3 commits into from Nov 24, 2022

Conversation

aaronadamsCA
Copy link
Contributor

Description

  • Specify gatsby-plugin-image optional peer dependencies.
  • Specify gatsby-source-shopify peer dependency on Gatsby.

Documentation

No docs required.

Note that the docs indicate gatsby-plugin-sharp is required, but this PR still marks it as optional. That's because it's possible to install and import from the gatsby-plugin-image package without actually loading the plugin in gatsby-config.js.

Related Issues

Fixes #34685.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Mar 16, 2022
@pieh pieh added type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Mar 21, 2022
@LekoArts
Copy link
Contributor

That's because it's possible to install and import from the gatsby-plugin-image package without actually loading the plugin in gatsby-config.js.

But that's not what people should do. Using the plugin without having it in the plugins array will break behavior in the build and thus it's required to have it defined. So I'd say gatsby-plugin-sharp shouldn't be optional.

@aaronadamsCA
Copy link
Contributor Author

Using the plugin without having it in the plugins array will break behavior in the build and thus it's required to have it defined.

Sorry if I was unclear - our use case here is for importing from gatsby-plugin-image into a UI library, as a transitive dependency of a Gatsby site.

  • UI package imports GatsbyImage from gatsby-plugin-image
  • Gatsby themes import UI package
  • Gatsby sites import Gatsby themes

IMO this is already valid, so we just suppress the warnings using packageExtensions in .yarnrc.yml to define peerDependenciesMeta on gatsby-plugin-image ourselves. I just wanted to contribute that back, since it should help anyone else with a large repo.

@LekoArts LekoArts changed the title Improve peer dependencies chore(gatsby-plugin-image): Add peerDependenciesMeta Nov 24, 2022
@LekoArts LekoArts added the topic: media Related to gatsby-plugin-image, or general image/media processing topics label Nov 24, 2022
@LekoArts LekoArts merged commit c935f05 into gatsbyjs:master Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: media Related to gatsby-plugin-image, or general image/media processing topics type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up peer dependencies in first-party plugins
3 participants