{"id":22279,"library":"rollup-plugin-virtual-fs","title":"rollup-plugin-virtual-fs","description":"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.","status":"active","version":"4.0.1-alpha.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install rollup-plugin-virtual-fs","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-virtual-fs","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-virtual-fs","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The plugin exports a named export, not a default. Using default import will result in undefined.","wrong":"import virtualFs from 'rollup-plugin-virtual-fs'","symbol":"virtualFs","correct":"import { virtualFs } from 'rollup-plugin-virtual-fs'"},{"note":"TypeScript users should import the type using 'import type' to avoid runtime inclusion.","wrong":"import { VirtualFsOptions } from 'rollup-plugin-virtual-fs'","symbol":"VirtualFsOptions","correct":"import type { VirtualFsOptions } from 'rollup-plugin-virtual-fs'"},{"note":"CommonJS require must destructure the named export, as the module does not set module.exports directly.","wrong":"const virtualFs = require('rollup-plugin-virtual-fs')","symbol":"rollup-plugin-virtual-fs (CommonJS)","correct":"const { virtualFs } = require('rollup-plugin-virtual-fs')"}],"quickstart":{"code":"// rollup.config.js\nimport { virtualFs } from 'rollup-plugin-virtual-fs';\n\nconst files = {\n  '/index.js': `import foo from './foo';\nexport default () => console.log(foo);`,\n  '/foo.js': 'export default \"foo\"',\n};\n\nexport default {\n  input: 'file:///index.js',\n  plugins: [\n    virtualFs({\n      files,\n      extensions: ['.ts', '.tsx', '.js', '/index.js'],\n    }),\n  ],\n};","lang":"typescript","description":"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."},"warnings":[{"fix":"Change 'import virtualFs from ...' to 'import { virtualFs } from ...'.","message":"Version 4.0.0 changed the plugin export from default to named export. Import { virtualFs } instead of the old default import.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use 'extensions' (array of strings) instead of 'extension' (string).","message":"The 'extension' option is renamed to 'extensions' (plural) in v4. Using 'extension' will be silently ignored.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Pin to a specific version and test thoroughly in non-production environments.","message":"The plugin is in alpha stage (4.0.1-alpha.0). API may change without notice. Not recommended for production.","severity":"gotcha","affected_versions":">=4.0.0-alpha"},{"fix":"Prefix input paths with 'file://'.","message":"Input must use 'file://' protocol (e.g., 'file:///index.js') to be resolved by the virtual filesystem.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Leave memoryOnly as true (default) unless you explicitly need fallback to disk.","message":"The '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.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"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';","cause":"Package version is alpha and may not be published correctly, or TypeScript cannot resolve types due to missing 'types' field in package.json.","error":"Cannot find module 'rollup-plugin-virtual-fs' or its corresponding type declarations."},{"fix":"Change import to: import { virtualFs } from 'rollup-plugin-virtual-fs';","cause":"Default import used when plugin exports a named function.","error":"TypeError: virtualFs is not a function"},{"fix":"Use 'extensions' as an array of strings, e.g., extensions: ['.js', '.ts'].","cause":"Using the old singular 'extension' option (string) instead of array 'extensions'.","error":"Error: The 'extension' option is not supported. Did you mean 'extensions'?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}