Registry / devops / rollup-plugin-virtual-fs

rollup-plugin-virtual-fs

JSON →
library4.0.1-alpha.0jsnpmunverified

A Rollup plugin that provides an in-memory virtual file system, allowing you to resolve and bundle files without a physical filesystem. Current version: 4.0.1-alpha.0 (unstable, pre-release). Release cadence: irregular, alpha stage. Key differentiator: enables full Rollup bundling purely from virtual file maps, with optional fallback to real filesystem. Supports custom extension resolution. TypeScript types included.

npm install rollup-plugin-virtual-fs
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-VIRT
R
rollup-plugin-virtual-fs
devopsjavascriptv4.0.1-alpha.0
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.

virtualFs
import { virtualFs } from 'rollup-plugin-virtual-fs'
import virtualFs from 'rollup-plugin-virtual-fs'
The plugin exports a named export, not a default. Using default import will result in undefined.
VirtualFsOptions
import type { VirtualFsOptions } from 'rollup-plugin-virtual-fs'
import { VirtualFsOptions } from 'rollup-plugin-virtual-fs'
TypeScript users should import the type using 'import type' to avoid runtime inclusion.
rollup-plugin-virtual-fs (CommonJS)
const { virtualFs } = require('rollup-plugin-virtual-fs')
const virtualFs = require('rollup-plugin-virtual-fs')
CommonJS require must destructure the named export, as the module does not set module.exports directly.

Configures Rollup to bundle from an in-memory virtual file system using rollup-plugin-virtual-fs, enabling zero-disk bundling for testing or ephemeral code.

// rollup.config.js import { virtualFs } from 'rollup-plugin-virtual-fs'; const files = { '/index.js': `import foo from './foo'; export default () => console.log(foo);`, '/foo.js': 'export default "foo"', }; export default { input: 'file:///index.js', plugins: [ virtualFs({ files, extensions: ['.ts', '.tsx', '.js', '/index.js'], }), ], };
Debug
Known issues
breakingVersion 4.0.0 changed the plugin export from default to named export. Import { virtualFs } instead of the old default import.
fix
Change 'import virtualFs from ...' to 'import { virtualFs } from ...'.
affects: >=4.0.0
deprecatedThe 'extension' option is renamed to 'extensions' (plural) in v4. Using 'extension' will be silently ignored.
fix
Use 'extensions' (array of strings) instead of 'extension' (string).
affects: >=4.0.0
gotchaThe plugin is in alpha stage (4.0.1-alpha.0). API may change without notice. Not recommended for production.
fix
Pin to a specific version and test thoroughly in non-production environments.
affects: >=4.0.0-alpha
gotchaInput must use 'file://' protocol (e.g., 'file:///index.js') to be resolved by the virtual filesystem.
fix
Prefix input paths with 'file://'.
affects: >=4.0.0
gotchaThe 'memoryOnly' option defaults to true. Setting it to false may expose real filesystem paths, which can be a security risk if files are controlled by untrusted sources.
fix
Leave memoryOnly as true (default) unless you explicitly need fallback to disk.
affects: >=4.0.0
Errors
Common errors & fixes
Cannot find module 'rollup-plugin-virtual-fs' or its corresponding type declarations.
Package version is alpha and may not be published correctly, or TypeScript cannot resolve types due to missing 'types' field in package.json.
fix
Ensure you have the latest alpha version installed: npm install rollup-plugin-virtual-fs@4.0.1-alpha.0. If types are missing, add a declaration file: declare module 'rollup-plugin-virtual-fs';
TypeError: virtualFs is not a function
Default import used when plugin exports a named function.
fix
Change import to: import { virtualFs } from 'rollup-plugin-virtual-fs';
Error: The 'extension' option is not supported. Did you mean 'extensions'?
Using the old singular 'extension' option (string) instead of array 'extensions'.
fix
Use 'extensions' as an array of strings, e.g., extensions: ['.js', '.ts'].
Upgrade
Version history
4.0.1-alpha.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
rollup-plugin-virtual-fs — npm install rollup-plugin-virtual-fs · libregistry