Skip to content

Conversation

@raggesilver
Copy link
Contributor

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)
  • 🐞 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.

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.
@raggesilver raggesilver requested a review from danielroe as a code owner May 25, 2025 02:51
@raggesilver raggesilver changed the title Fix #1850 fix: incorrect preload link for multiple densities May 25, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented May 25, 2025

Open in StackBlitz

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

commit: 4aa2807

@codecov-commenter
Copy link

codecov-commenter commented May 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ 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           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@vercel
Copy link

vercel bot commented Aug 13, 2025

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

A member of the Team first needs to authorize it.

@ahmadalfy
Copy link

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

@vercel
Copy link

vercel bot commented Aug 19, 2025

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

@danielroe danielroe merged commit eeb00f3 into nuxt:main Aug 19, 2025
7 checks passed
@github-actions github-actions bot mentioned this pull request Aug 19, 2025
@github-actions github-actions bot mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect preload links for single size, multiple densities images

4 participants