Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: Defining an array densities does not generate images #212

Open
filipjakov opened this issue Oct 13, 2020 · 1 comment
Open

v3: Defining an array densities does not generate images #212

filipjakov opened this issue Oct 13, 2020 · 1 comment

Comments

@filipjakov
Copy link

filipjakov commented Oct 13, 2020

Great job on the new version, really like the dx.

Version:

  • "next-optimized-images": "^3.0.0-canary.10"

Setup:

  • everything per recommended in the docs
  • next.config.js:
javascript
    [
      optimizedImages,
      {
        images: {
          handleImages: ['jpeg', 'png', 'webp'],
          webp: {
            quality: 100,
            nearLossless: true,
          },
        },
      },
    ],
  • images.config.js:
module.exports = {
	default: {
		webp: true,
		densities: [1, 2]
	},
};

Usage:

...
<Img src={Hero} />
...

The problem

  • original image is png; the only thing generated is an optimized png and webp image, but no images with defined densities

  • various densities reference the "same" image element

  • also does not work when defining densities inline, on the Img elements themselves

  • HTML looks like the following

<picture>
  <source type="image/webp" srcset="/_next/static/chunks/images/landing-hero-d7a2b56784e764765f7be1e94ebcc13a.webp, /_next/static/chunks/images/landing-hero-d7a2b56784e764765f7be1e94ebcc13a.webp 2x, /_next/static/chunks/images/landing-hero-d7a2b56784e764765f7be1e94ebcc13a.webp 3x">
  <source type="image/png" srcset="/_next/static/chunks/images/landing-hero-0de1f1910a9d4f45cf113b0277fe4f8a.png, /_next/static/chunks/images/landing-hero-0de1f1910a9d4f45cf113b0277fe4f8a.png 2x, /_next/static/chunks/images/landing-hero-0de1f1910a9d4f45cf113b0277fe4f8a.png 3x">
  <img src="/_next/static/chunks/images/landing-hero-0de1f1910a9d4f45cf113b0277fe4f8a.png">
</picture>

Expected behavior

  • images with defined densities get generated and referenced in the HTML as expected
@incompletude
Copy link

Any news on this?

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

No branches or pull requests

2 participants