Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@farbenmeer/next-image-autosize

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@farbenmeer/next-image-autosize

A wrapper around next/image that automatically sets width and height.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

next-image-autosize

A wrapper around next/image that automatically sets width and height.

This is useful in testing and development-environments where next-image-loader is not available (e.G. storybook). It will render a next/image without knowing the width and height beforehand by rendering a plain <img> first, then reading out the image dimensions and replacing the <img> with next/image.

Warning

DO NOT USE THIS IN PRODUCTION It will cause layout shift on two subsequent renders.

Usage

Storybook

// .storybook/preview.js
import * as NextImage from 'next/image'
import NextImageAutosize from '@farbenmeer/next-image-autosize'

const OriginalNextImage = NextImage.default

Object.defineProperty(NextImage, 'default', {
  configurable: true,
  value: NextImageAutosize
})

FAQs

Package last updated on 22 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc