nextjs-image-loader-stub

0.0.2 • Public • Published

nextjs-image-loader-stub

A webpack image loader library for creating Next.js image loader stubs.

Install

$ npm install nextjs-image-loader-stub --save-dev

Usage

import image from './images/foobar.png';

export const Foobar = () => {
  return <img src={image.src} width={image.width} height={image.height} />;
};

Configure for storybook

// .storybook/main.js

module.exports = {
  webpackFinal: async (config) => {
    return {
      ...config,
      module: {
        ...config.module,
        rules: [
          ...config.module.rules,
          {
            test: /\.(bmp|png|jpe?g|gif|webp|avif)$/,
            use: 'nextjs-image-loader-stub',
            type: 'javascript/auto',
          }
        ]
      }
    };
  },
};

Readme

Keywords

none

Package Sidebar

Install

npm i nextjs-image-loader-stub

Weekly Downloads

4

Version

0.0.2

License

MIT

Unpacked Size

3.06 kB

Total Files

6

Last publish

Collaborators

  • anatoo