-
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
fix(gatsby-plugin-sharp): error if we can't determine dimensions for image #23156
fix(gatsby-plugin-sharp): error if we can't determine dimensions for image #23156
Conversation
Prettier 2 added a bunch of extra changes on commit via husky. I can't make it not do that without downgrading prettier or removing husky, so I assume this is fine. |
@TylerBarnes Looks like you have old Prettier (which uses new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't merge Prettier related issues when it's due to Prettier 1 runtime on a Prettier 2 config.
Turns out you can run |
(Consider my request for changes removed. Github won't let me, other than to accept it, but that's not what we want either, so meh. Ignore me in this PR :) ) |
Thanks @pvdz , I thought it was from our new config or something. Good to know I just need to use v2 instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!!!
This adds an error when dimensions for an image can't be determined. This happens when a file is corrupt. Previously the only error we got was
TypeError: Cannot read property 'width' of null
. I explored using another image dimensions package that gives us more meaning errors but it was giving other unrelated errors and seems like a risky change. Since the current package returns null if it can't find dimensions, I just error on null dimensions here and provide a generic message.