-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Gatsby + NetlifyCMS image src not correct and srcset not being used #12572
Gatsby + NetlifyCMS image src not correct and srcset not being used #12572
Comments
I've seen some problems when using |
You’re a star, thanks for having a look at this! What I find weird (frustrating!), is that before it broke, it was working brilliantly, to the point where I was surprised at how easy it was to set up! |
It seems like there is problem with |
Interesting... when you say it works, what result did you get? I’ve just tried commenting out that plugin, cleaned cache, removed package.lock and then did a build & serve, but still have the same results in terms of the image src being incorrect? Oh and thanks for the update, can’t tell you how much I appreciate your help! |
Yeah, after doing more investigating it seems like this was accidental - it seems somewhere else we have some problem with async code actually - I'm still checking this out - debugging async code is just the worst ;( |
Ok, seems like last release of please pin version of |
Tried doing that, did the same clean cache, delete node modules and .lock then did build and serve but still all the image src attributes are looking for ../../../static/assets. Should that have been resolved now by pinning the version? |
at least temporarirly, yes - when you remove I just openend Pull Request with fix ( #12578 ), but it's not merged and released yet |
Hmm, where it still isn’t working for me, does that mean I’ve probably got another error somewhere else that’s causing the src paths to be incorrect? |
can you paste |
I've merged the fix to |
Just tried it again now and we're all good! Thank you for working this out for me, I'd have never managed on my own! I'm pretty new to the web dev community as a whole, only been doing this for 8 months or so, so I was just wondering what your process for working all this out was? |
lot of trial error, console.log(s), checking git history with related packages and educated guesses ;) |
Description
After gatsby develop and build, the src attribute of images in markdown files(coming from NetlifyCMS) tries to look at where the image has been saved in the repo - ../../../static/assets/image.jpg
This occurred after updating a number of packages:
"gatsby": "^2.1.31",
"gatsby-plugin-netlify": "^2.0.12",
"gatsby-plugin-netlify-cms": "^3.0.14",
"gatsby-plugin-sharp": "^2.0.28",
"gatsby-source-filesystem": "^2.0.24",
"gatsby-transformer-remark": "^2.3.2",
"gatsby-transformer-sharp": "^2.1.17",
"netlify-cms": "^2.6.1",
However, reverting the the previous versions did not resolve my issue.
The commit before updating to these packages works as expected, nothing else changed in between.
As of before updating packages when everything was working, images loaded as expected with all of the srcset attributes etc for responsive images.
Annoyingly, all of the different size versions of each image are being correctly created inside the public/static folder, but for reasons unknown to me these files are not being used at all!
Steps to reproduce
The repo is at https://github.com/JoshLong23/barebones-NetlifyCMS and can be found live at https://faithful-waffle-a4ff4a.netlify.com
Expected result
As above, images should load with the correct src path looking at the public/assets folder and with the correct srcset attributes.
Environment
System:
OS: Windows 7
CPU: (12) x64 Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
gatsby: ^2.1.31 => 2.1.32
gatsby-plugin-netlify: ^2.0.12 => 2.0.12
gatsby-plugin-netlify-cms: ^3.0.14 => 3.0.14
gatsby-plugin-sharp: ^2.0.28 => 2.0.28
gatsby-remark-copy-linked-files: ^2.0.10 => 2.0.10
gatsby-remark-images: ^3.0.9 => 3.0.9
gatsby-remark-relative-images: ^0.2.2 => 0.2.2
gatsby-source-filesystem: ^2.0.24 => 2.0.25
gatsby-transformer-remark: ^2.3.2 => 2.3.3
gatsby-transformer-sharp: ^2.1.17 => 2.1.17
I've really tried to find out what's gone wrong here, but to no avail, any help you can offer would be hugely appreciated!
The text was updated successfully, but these errors were encountered: