diff --git a/packages/gatsby-plugin-sharp/src/index.js b/packages/gatsby-plugin-sharp/src/index.js index 8237bc0abe00d..0b3d080cd568f 100644 --- a/packages/gatsby-plugin-sharp/src/index.js +++ b/packages/gatsby-plugin-sharp/src/index.js @@ -127,13 +127,14 @@ const processFile = (file, jobs, cb, reporter) => { } else { clonedPipeline = pipeline } - // Sharp only allows ints as height/width. Since height isn't always - // set, check first before trying to round it. - let roundedHeight = args.height - if (roundedHeight) { - roundedHeight = Math.round(roundedHeight) - } - const roundedWidth = Math.round(args.width) + // Sharp only allows ints as height/width. Since either height or width + // could not be set, check first before trying to round them. + let roundedHeight = args.hasOwnProperty(args, `height`) + ? Math.round(args.height) + : undefined + const roundedWidth = args.hasOwnProperty(args, `width`) + ? Math.round(args.width) + : undefined clonedPipeline .resize(roundedWidth, roundedHeight) .crop(args.cropFocus) diff --git a/packages/gatsby-transformer-sharp/src/extend-node-type.js b/packages/gatsby-transformer-sharp/src/extend-node-type.js index f8a8159b9ac0f..f8d2af200a89c 100644 --- a/packages/gatsby-transformer-sharp/src/extend-node-type.js +++ b/packages/gatsby-transformer-sharp/src/extend-node-type.js @@ -105,7 +105,6 @@ const fixedNodeType = ({ args: { width: { type: GraphQLInt, - defaultValue: 400, }, height: { type: GraphQLInt, @@ -222,7 +221,6 @@ const fluidNodeType = ({ args: { maxWidth: { type: GraphQLInt, - defaultValue: 800, }, maxHeight: { type: GraphQLInt,