Skip to content
Merged
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
27 changes: 16 additions & 11 deletions packages/gatsby-remark-images/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ module.exports = (
fileType !== `svg`
) {
const rawHTML = await generateImagesAndUpdateNode(node, resolve)
// Replace the image node with an inline HTML node.
node.type = `html`
node.value = rawHTML
return resolve(node)
} else {
// Image isn't relative so there's nothing for us to do.
return resolve()

if (rawHTML != null) {
// Replace the image node with an inline HTML node.
node.type = `html`
node.value = rawHTML
}
}

// Image isn't relative so there's nothing for us to do.
return resolve()
})
)
).then(markdownImageNodes =>
Expand Down Expand Up @@ -197,11 +199,14 @@ module.exports = (
formattedImgTag,
resolve
)
// Replace the image string
thisImg.replaceWith(rawHTML)
} else {
return resolve()

if (rawHTML != null) {
// Replace the image string
thisImg.replaceWith(rawHTML)
}
}

return resolve()
}

// Replace the image node with an inline HTML node.
Expand Down