Skip to content

Commit

Permalink
fix(contentful): make gatsby-plugin-image a peer dependency (#30709)
Browse files Browse the repository at this point in the history
fixes #30519
  • Loading branch information
axe312ger committed Apr 7, 2021
1 parent 6b2fd94 commit 0f3fa4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby-source-contentful/package.json
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
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

0 comments on commit 0f3fa4e

Please sign in to comment.