A package that allows loading image files (PNG, SVG, JPG, JPEG, GIF, WebP, AVIF, ICO, BMP) in Node.js, Rollup, Vite, or Vitest the same way as Next.js. Current stable version is 0.1.2. It provides a Rollup plugin and a Node.js loader. The generated modules expose src, width, height, and a default export. Compatible with Node.js 22+. Key differentiator: it mimics Next.js image handling in non-Next.js environments, enabling consistent image imports across tools.
npm install image-loader-nextVerified import paths — ran on the pinned version, not inferred.
Shows Vite plugin setup and Node.js loader registration then image import usage.
Upgrade Node.js to version 22 or higher.
Access .src for the URL string: import img from './img.png' console.log(img.src, img.width, img.height)
Ensure import { nextImages } from 'image-loader-next/rollup' and not from 'image-loader-next'.Register the loader early in your entry file (e.g., at the top of the main module).
Install the package: npm install image-loader-next. Use correct subpath: 'image-loader-next/node'.
Use: import { nextImages } from 'image-loader-next/rollup'Upgrade to Node.js 22+ and use `node --loader image-loader-next` or call `register()` programmatically.
No dependency data recorded yet.