Skip to content

Incorrect preload links for single size, multiple densities images #1850

Description

@raggesilver

The following scenario does not work properly:

<template>
  <NuxtImg
    src="/my-img.webp"
    width="300"
    height="300"
    fit="inside"
    preload
  />
</template>

This generates something like:

<link rel="preload" as="image" href="/_ipx/f_webp&fit_inside&s_300x300/my-img.webp">

But that does not take densities into account (1x and 2x by default).

<link rel="preload" as="image" href="/_ipx/f_webp&fit_inside&s_600x600/my-img.webp" imagesrcset="/_ipx/f_webp&fit_inside&s_300x300/my-img.webp 1x, /_ipx/f_webp&fit_inside&s_600x600/my-img.webp 2x">

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions