Skip to content

Commit 0f3fa4e

Browse files
authored
fix(contentful): make gatsby-plugin-image a peer dependency (#30709)
fixes #30519
1 parent 6b2fd94 commit 0f3fa4e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/gatsby-source-contentful/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"contentful": "^8.1.7",
1919
"fs-extra": "^9.1.0",
2020
"gatsby-core-utils": "^2.3.0-next.0",
21-
"gatsby-plugin-image": "^1.3.0-next.1",
2221
"gatsby-plugin-utils": "^1.3.0-next.0",
2322
"gatsby-source-filesystem": "^3.3.0-next.0",
2423
"is-online": "^8.5.1",
@@ -45,6 +44,7 @@
4544
"license": "MIT",
4645
"peerDependencies": {
4746
"gatsby": "^3.0.0-next.0",
47+
"gatsby-plugin-image": "^1.3.0-next.1",
4848
"gatsby-plugin-sharp": "^3.0.0-next.0",
4949
"sharp": "^0.26.0"
5050
},

packages/gatsby-source-contentful/src/extend-node-type.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ const {
1515
GraphQLList,
1616
} = require(`gatsby/graphql`)
1717
const qs = require(`qs`)
18-
const { generateImageData } = require(`gatsby-plugin-image`)
19-
const {
20-
getGatsbyImageFieldConfig,
21-
} = require(`gatsby-plugin-image/graphql-utils`)
2218
const { stripIndent } = require(`common-tags`)
2319

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

719+
const { generateImageData } = require(`gatsby-plugin-image`)
720+
723721
const { baseUrl, contentType, width, height } = getBasicImageProps(
724722
image,
725723
options
@@ -773,6 +771,10 @@ exports.extendNodeType = ({ type, store }) => {
773771

774772
// gatsby-plugin-image
775773
const getGatsbyImageData = () => {
774+
const {
775+
getGatsbyImageFieldConfig,
776+
} = require(`gatsby-plugin-image/graphql-utils`)
777+
776778
const fieldConfig = getGatsbyImageFieldConfig(resolveGatsbyImageData, {
777779
jpegProgressive: {
778780
type: GraphQLBoolean,

0 commit comments

Comments
 (0)