npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2025 – Pkg Stats / Ryan Hefner

@rsbuild-image/core

v0.0.1-next.36

Published

> 🚧 The plugin is under active development, and the API is not stable. Please create an issue if you meet any trouble.

Downloads

2,676

Readme

@rsbuild-image/core

🚧 The plugin is under active development, and the API is not stable. Please create an issue if you meet any trouble.

The image plugin for Rsbuild applications, which provide an <Image /> component to render images with series features for better performance and developer experience.

Features

  • Built-in Best Practices 🎯

    • πŸš€ Automatic lazy loading for non-viewport images to save CDN bandwidth and improve loading performance.
    • ✨ Built-in blur placeholder for better user experience with minimal cost.
  • Compile-time Optimization ⚑️

    • πŸ“ Pre-calculated image dimensions to prevent Cumulative Layout Shift (CLS).
    • πŸ”„ Optimized image processing pipeline without slowing down the build process.
  • Image Hosting Integration πŸ–ΌοΈ

    • πŸ”₯ High-performance, cache-friendly image processing for images from any source at runtime.
    • πŸ› οΈ No manual image optimization required during development.
  • Responsive Image Loading πŸ“±

    • 🎨 Automatic generation of multiple image sizes based on responsive configurations.
    • 🌐 Smart format selection based on browser compatibility.
    • πŸ“ Optimal image size loading for scalable elements.

Prerequisite

  • Node.js: >= 16.14
  • Rsbuild: >= 1.3.5
  • Sharp: High performance Node.js image processing library.
  • IPX (Optional): Image processing middleware based on sharp. Provides the image processing capabilities for the development server.

Installation

Install the dependencies:

$ pnpm add -D sharp ipx
$ pnpm add @rsbuild-image/core

The sharp binary is required to be installed on your system, you can install the experimental WebAssembly variant of sharp if you have any trouble while installing binary, please refer to the sharp installation guide for more details.

The ipx package is optional, it provides the image processing capabilities for the development server. You probably no need to install it if you don't want to use the development server or you already have a custom image processing middleware.

Quick Start

Setup the plugin to your Rsbuild configuration file, set ipx to {} to enable the optional ipx image processing middleware if you already have it installed. Or you must implement your own image loader.

rsbuild.config.ts

import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginImage } from '@rsbuild-image/core';

export default defineConfig({
  plugins: [pluginReact(), pluginImage({ ipx: {} })]
});

Or if you are using Modern.js, you can setup the plugin in the modern.config.ts file.

modern.config.ts

import { appTools, defineConfig } from '@modern-js/app-tools';
import { pluginImage } from '@rsbuild-image/core';

export default defineConfig({
  plugins: [appTools({ bundler: 'rspack' })],
  builderPlugins: [pluginImage({ ipx: {} })]
});

Then configure the tsconfig.json file to handle all image assets suffixed with ?image.

tsconfig.json

{
  "compilerOptions": {
    "types": ["@rsbuild-image/core/types"]
  }
}

So that you can use the <Image /> component in your React application:

import { Image } from '@rsbuild-image/core/runtime';
import imgMountains from './mountains.jpg?image';
//     ^? { url: string; width: number; height: number; thumbnail: ...

export default function App() {
  return (
    <Image src={imgMountains} width={300} placeholder="blur" alt="example" />
    // Will actually request to: /_rsbuild/ipx/f_auto,w_300,q_75/static/assets/mountains.085a2b79.jpg
    // <Image /> will infer the height according to the width and keep the aspect ratio,
    // So that it won't take any cumulative layout shift.
    // And a blurred thumbnail will be used as placeholder before the image is loaded.
  );
}

API Reference

WIP

Credit

License

MIT