image icon indicating copy to clipboard operation
image copied to clipboard

fix: incorrect preload link for multiple densities

Open raggesilver opened this issue 6 months ago โ€ข 2 comments

NuxtImg did not add correct preload links for images that had multiple densities but only one size which caused the preload tag to load 1x images for devices with 2x pixel ratio. That is now fixed.

๐Ÿ”— Linked issue

Resolves #1850

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation or readme)
  • [x] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

Do not require both sizes and densities to be set to generate imagesrcset. Take each of them into account.

raggesilver avatar May 25 '25 02:05 raggesilver

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@1851

commit: 4aa2807

pkg-pr-new[bot] avatar May 25 '25 02:05 pkg-pr-new[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 7.09%. Comparing base (96ec681) to head (4aa2807).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1851   +/-   ##
=====================================
  Coverage   7.08%   7.09%           
=====================================
  Files         76      76           
  Lines       3527    3525    -2     
  Branches     137     137           
=====================================
  Hits         250     250           
+ Misses      3230    3228    -2     
  Partials      47      47           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar May 25 '25 02:05 codecov-commenter

@raggesilver is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Aug 13 '25 00:08 vercel[bot]

Can we get this simple merge request merged? I can confirm this change applies the needed fix.

ahmadalfy avatar Aug 19 '25 09:08 ahmadalfy

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Updated (UTC)
image-docus Ignored Ignored Aug 19, 2025 3:53pm

vercel[bot] avatar Aug 19 '25 15:08 vercel[bot]