
Security News
npm v12 Ships With Install Scripts Off by Default, Begins Deprecating 2FA-Bypass Tokens
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.
@rollup/plugin-image
Advanced tools
🍣 A Rollup plugin which imports JPG, PNG, GIF, SVG, and WebP files.
Images are encoded using base64, which means they will be 33% larger than the size on disk. You should therefore only use this for small images where the convenience of having them available on startup (e.g. rendering immediately to a canvas without co-ordinating asynchronous loading of several images) outweighs the cost.
This plugin requires an LTS Node version (v14.0.0+) and Rollup v1.20.0+.
Using npm:
npm install @rollup/plugin-image --save-dev
Assuming a src/index.js exists and contains code like the following:
import logo from './rollup.png';
console.log(logo);
Create a rollup.config.js configuration file and import the plugin:
import image from '@rollup/plugin-image';
export default {
input: 'src/index.js',
output: {
dir: 'output',
format: 'cjs'
},
plugins: [image()]
};
Then call rollup either via the CLI or the API.
Once the bundle is executed, the console.log will display the Base64 encoded representation of the image.
domType: Boolean
Default: false
If true, instructs the plugin to generate an ES Module which exports a DOM Image which can be used with a browser's DOM. Otherwise, the plugin generates an ES Module which exports a default const containing the Base64 representation of the image.
Using this option set to true, the export can be used as such:
import logo from './rollup.png';
document.body.appendChild(logo);
excludeType: String | Array[...String]
Default: null
A picomatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.
includeType: String | Array[...String]
Default: null
A picomatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.
rollup-plugin-url is a Rollup plugin that allows you to import files as data-URIs or copy them to the output directory. It supports various file types, including images, and can be configured to inline files below a certain size limit. Compared to @rollup/plugin-image, rollup-plugin-url offers more flexibility in handling different file types and inlining small files.
rollup-plugin-image-files is another Rollup plugin that enables importing image files into your JavaScript modules. It is similar to @rollup/plugin-image but may offer different configuration options or support for additional image formats. It is a good alternative if you need more specific features or configurations.
FAQs
Import JPG, PNG, GIF, SVG, and WebP files
The npm package @rollup/plugin-image receives a total of 937,408 weekly downloads. As such, @rollup/plugin-image popularity was classified as popular.
We found that @rollup/plugin-image demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.

Research
/Security News
Socket tracks the activity as Operation “Muck and Load”: a threat actor uses commit-farming workflows, public dead drops, and protected archives to stage Windows RAT and infostealer malware.

Security News
pnpm 11.10 hardens registry auth to block token redirection, tightens pack-app and deploy, and makes the Rust port (v12) installable.