geelen / react-snapshot

A zero-configuration static pre-renderer for React apps
MIT License
1.66k stars 105 forks source link

Picture tag incorrectly populating src #18

Open martinbethann opened 7 years ago

martinbethann commented 7 years ago

When using the picture tag with a "source" and "src", react-snapshot will populate the src with the "source". For example, this is the correct code and what we see in the development build:

<picture data-object-fit="contain">
  <source media="(min-width: 640px)" sizes="(min-width: 1000px) 100vw, 1900px" srcset="hero_D.jpg">
  <img alt="alt text" src="hero_M.jpg">
</picture>

but instead it is rendering this after the snapshot, and note the correct image in data-pfsrc. src is displaying what was set in srcset:

<picture data-reactid="14">
  <source media="(min-width: 640px)" sizes="(min-width: 1000px) 100vw, 1900px" srcset="hero_D.jpg" data-reactid="15">
  <img alt="alt text" src="hero_D.jpg" data-reactid="16" data-pfsrc="hero_M.jpg">
</picture>

Thanks!

geelen commented 7 years ago

Oh wow. That is... super weird. Do you have a repo I could take a look at?

martinbethann commented 7 years ago

No, unfortunately - it's a private repo.

geelen commented 7 years ago

Hey @martinbethann could you try again on the latest version v1.1.0?

stereobooster commented 6 years ago

@martinandert you can try to extract the failing part in public repo