fix(render): strip image preload links with imagesrcset or imagesizes when as=image is omitted

Closed
TY
24d ago
+23-2

Summary

When React renders images with srcSet or sizes during server-side rendering, it can emit link tags with imagesrcset or imagesizes where the as=image attribute is omitted.

The stripImagePreloadLinks utility previously checked only attributes.rel === 'preload' && attributes.as === 'image', causing image preload links containing imagesrcset or imagesizes attributes without an explicit as=image tag to remain in the rendered HTML output.

This PR updates isImagePreloadLink to check for imagesrcset and imagesizes attributes so all React-injected image preloads are stripped from rendered email HTML.

Testing

  • Added unit test in packages/render/src/shared/utils/strip-image-preload-links.spec.ts.

Summary by cubic

Fixes stripImagePreloadLinks so React-injected image preloads with imagesrcset or imagesizes are removed from rendered email HTML even when as="image" is omitted. Also makes create-email exit on failed or invalid npm registry responses instead of proceeding with a bad version.

Bug Fixes

  • isImagePreloadLink now matches preload links with imagesrcset or imagesizes; non-image preloads are still preserved.
  • create-email logs the HTTP status and exits when the registry request fails or returns an invalid version.