Registry / devops / rollup-plugin-image-files

rollup-plugin-image-files

JSON →
library1.4.2jsnpmunverified

Rollup plugin that copies image files to the output directory and replaces imports with require() references. Version 1.4.2, likely low maintenance cadence. Unlike rollup-plugin-image which inlines base64, this preserves binary files, making it suitable for React Native libraries where images must be bundled separately. Limited scope and niche use case.

npm install rollup-plugin-image-files
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-IMAG
R
rollup-plugin-image-files
devopsjavascriptv1.4.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import images from 'rollup-plugin-image-files'
const images = require('rollup-plugin-image-files')
ESM default import is standard; CJS require may not work if package does not export CJS.
images
import images from 'rollup-plugin-image-files'
The default export is the plugin factory function.

Basic Rollup configuration using rollup-plugin-image-files to handle image imports by copying files to output.

import images from 'rollup-plugin-image-files'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'cjs' }, plugins: [images()] };
Debug
Known issues
gotchaPlugin copies images to the same directory as the output bundle; may cause path collisions if multiple images have the same filename.
fix
Ensure unique image filenames or use a custom naming function (if supported).
affects: >=0.0.0
gotchaOnly works with static image imports (string literal paths); dynamic imports or computed paths are not handled.
fix
Use static import paths for images.
affects: >=0.0.0
gotchaOutput format must be CommonJS (cjs) for the generated require() calls to work in Node.js environments like React Native.
fix
Set output.format to 'cjs' in Rollup config.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Could not resolve '../path/to/image.png' from 'src/index.js'
Plugin not installed or configured correctly; Rollup cannot resolve image file.
fix
Ensure plugin is added to plugins array and images are in a directory relative to the source file.
TypeError: images is not a function
Attempting to call the import as a function, but the import is the default export which is already a function (should be called in plugins array).
fix
Use `plugins: [images()]` not `plugins: [images]`.
Upgrade
Version history
1.4.2latest on npm
Audit
Dependencies
rolluprequiredpeer dependency for plugin interface
Agent activity
9 hits · last 30 days
node
8
Resources
rollup-plugin-image-files — npm install rollup-plugin-image-files · libregistry