Registry /
devops / rollup-plugin-image-assets
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
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
images
✓ import images from 'rollup-plugin-image-assets'
✗ const images = require('rollup-plugin-image-assets')
Plugin is ESM-only; using require() will fail unless your project uses esModuleInterop.
images (default)
✓ import images from 'rollup-plugin-image-assets'
✗ import { images } from 'rollup-plugin-image-assets'
Plugin is exported as default, not a named export.
Image source
✓ import imageSrc from './path/to/image.png'
✗ const imageSrc = require('./path/to/image.png')
Rollup resolves image imports to strings (file URLs). CommonJS require may not work in all environments.
Shows basic setup: install plugin, configure output directory, and import image file resulting in a hashed URL.
// rollup.config.js
import images from 'rollup-plugin-image-assets';
export default {
input: 'src/index.js',
output: {
dir: 'dist',
format: 'esm'
},
plugins: [
images({
output: 'assets/images'
})
]
};
// src/index.js
import logo from './logo.png';
console.log(logo); // e.g., '/assets/images/logo_abc123.png'
Errors
Common errors & fixes
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
Rollup cannot handle image imports without the plugin.
fixAdd rollup-plugin-image-assets to your rollup config.
TypeError: Cannot read properties of undefined (reading 'substring')
Plugin received malformed file path or unsupported image type.
fixEnsure image files have common extensions (png, jpg, gif, svg).
Error: Could not resolve './image.png' from 'src/index.js'
Plugin not installed or misconfigured.
fixInstall the plugin and add it to plugins array in rollup config.
Audit
Dependencies
No dependency data recorded yet.