A Rollup plugin that uses an in-memory filesystem (memfs) as the file system backend, enabling unit testing of Rollup builds without writing to disk. Current version is 4.0.1-alpha.0. It replaces Rollup's default file system with a memfs instance, allowing deterministic tests and fast iteration. Key differentiators: works with memfs v4, supports Promise-based memfs API, and is TypeScript-native. Compared to alternatives like rollup-plugin-mock-fs, this plugin integrates directly with memfs's Volume for fine-grained virtual file control.
npm install rollup-plugin-memfsVerified import paths — ran on the pinned version, not inferred.
Creates an in-memory filesystem with memfs, uses it as Rollup's file system, and generates a bundle without touching disk.
Update import to ESM: import { memfsPlugin } from 'rollup-plugin-memfs'. No more default export.Use memfs v4 and its Promise-based API: import createFs from 'memfs/lib/promises'.
Install memfs separately: npm install memfs
Set onwarn to log warnings: onwarn(warning, defaultHandler) => { console.warn(warning.message); }Switch to ESM: use import or set type:"module" in package.json.
Use named import: import { memfsPlugin } from 'rollup-plugin-memfs'.Add the file to the volume: vol.fromJSON({'/index.js': 'content'}).No dependency data recorded yet.