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

fix(contentful): make gatsby-plugin-image a peer dependency #30709

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gatsby-source-contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"contentful": "^8.1.7",
"fs-extra": "^9.1.0",
"gatsby-core-utils": "^2.3.0-next.0",
"gatsby-plugin-image": "^1.3.0-next.1",
"gatsby-plugin-utils": "^1.3.0-next.0",
"gatsby-source-filesystem": "^3.3.0-next.0",
"is-online": "^8.5.1",
Expand All @@ -45,6 +44,7 @@
"license": "MIT",
"peerDependencies": {
"gatsby": "^3.0.0-next.0",
"gatsby-plugin-image": "^1.3.0-next.1",
"gatsby-plugin-sharp": "^3.0.0-next.0",
"sharp": "^0.26.0"
},
Expand Down
10 changes: 6 additions & 4 deletions packages/gatsby-source-contentful/src/extend-node-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ const {
GraphQLList,
} = require(`gatsby/graphql`)
const qs = require(`qs`)
const { generateImageData } = require(`gatsby-plugin-image`)
const {
getGatsbyImageFieldConfig,
} = require(`gatsby-plugin-image/graphql-utils`)
const { stripIndent } = require(`common-tags`)

const cacheImage = require(`./cache-image`)
Expand Down Expand Up @@ -720,6 +716,8 @@ exports.extendNodeType = ({ type, store }) => {
const resolveGatsbyImageData = async (image, options) => {
if (!isImage(image)) return null

const { generateImageData } = require(`gatsby-plugin-image`)

const { baseUrl, contentType, width, height } = getBasicImageProps(
image,
options
Expand Down Expand Up @@ -773,6 +771,10 @@ exports.extendNodeType = ({ type, store }) => {

// gatsby-plugin-image
const getGatsbyImageData = () => {
const {
getGatsbyImageFieldConfig,
} = require(`gatsby-plugin-image/graphql-utils`)

const fieldConfig = getGatsbyImageFieldConfig(resolveGatsbyImageData, {
jpegProgressive: {
type: GraphQLBoolean,
Expand Down