{"id":20809,"library":"webpack-plugin-ramdisk","title":"webpack-plugin-ramdisk","description":"A Webpack plugin that creates and mounts a RAM disk for blazing fast build output, using the OS native filesystem instead of in-memory JS filesystems. v0.2.0 is the latest stable release (infrequent updates). Key differentiators: prevents excessive SSD writes during HMR, supports both macOS and Linux, integrates as a standard Webpack plugin. Unlike webpack-virtual-modules or memfs, this leverages real OS-level RAM drives for true I/O speed. Requires Node >=10 and Webpack 4 or 5.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/shellscape/webpack-plugin-ramdisk","tags":["javascript","dev","development","disk","drive","in-memory","memory","ram","ramdisk"],"install":[{"cmd":"npm install webpack-plugin-ramdisk","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-plugin-ramdisk","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-plugin-ramdisk","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin hooks into Webpack compilation lifecycle","package":"webpack","optional":false}],"imports":[{"note":"Always use the named export via destructuring. Requires() is the only supported import style in this package (no ESM).","wrong":"const WebpackPluginRamdisk = require('webpack-plugin-ramdisk')","symbol":"WebpackPluginRamdisk","correct":"const { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk')"},{"note":"ESM imports are supported in modern Node versions, but must use named import syntax. Default import will fail.","wrong":"import WebpackPluginRamdisk from 'webpack-plugin-ramdisk'","symbol":"WebpackPluginRamdisk","correct":"import { WebpackPluginRamdisk } from 'webpack-plugin-ramdisk'"},{"note":"cleanup is a static method on the class, not a separate export. Access via the class symbol or require the class then destructure.","wrong":"const { cleanup } = require('webpack-plugin-ramdisk')","symbol":"WebpackPluginRamdisk.cleanup","correct":"const { cleanup } = require('webpack-plugin-ramdisk').WebpackPluginRamdisk"}],"quickstart":{"code":"const path = require('path');\nconst { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk');\n\nmodule.exports = {\n  output: {\n    path: '/myapp/dist'\n  },\n  plugins: [\n    new WebpackPluginRamdisk({\n      blockSize: 512,\n      bytes: 2.56e8,\n      name: 'wpr'\n    })\n  ]\n};","lang":"javascript","description":"Basic Webpack configuration using the RAM disk plugin with output path and plugin options."},"warnings":[{"fix":"Set output.path to a path relative to the RAM disk root (e.g., '/myapp/dist'). Do not prefix '/Volumes/wpr' or '/mnt/wpr' manually.","message":"The plugin modifies the output path: the disk root is prepended to the configured output path (e.g., output.path '/myapp/dist' becomes '/Volumes/wpr/myapp/dist' on macOS). Ensure your output path does not already include the disk root.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use alternative in-memory filesystem like memfs or webpack-virtual-modules for cross-platform builds.","message":"The plugin requires Node's 'fs' module and OS-native RAM disk creation. This does NOT on Windows — only macOS and Linux are supported. Configuration may fail silently on Windows.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure the mount point directory does not exist before running the plugin (e.g., remove /Volumes/wpr or /mnt/wpr). The plugin will create it.","message":"The RAM disk is mounted at a system-specific path: macOS: /Volumes/<name>, Linux: /mnt/<name>. The code assumes the mount path exists and is writable. If the path is already occupied, the plugin may fail.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Increase the `bytes` option to accommodate your build output size. Use process.memoryUsage() or estimate output size.","message":"Large builds may exceed the default 256 MB RAM disk size (bytes: 2.56e8). If the build output is larger, the plugin will fail with a disk full error.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Call WebpackPluginRamdisk.cleanup(diskPath) manually in your script's exit handler (e.g., process.on('exit', ...)).","message":"The plugin does NOT clean up the RAM disk when the process exits. The disk remains mounted and consumes RAM until manually unmounted (diskutil unmount /Volumes/wpr or umount /mnt/wpr).","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure the plugin is configured correctly and the system supports RAM disks. On macOS, run 'diskutil info /Volumes/wpr' to check. On Linux, ensure /mnt exists and is writable.","cause":"The RAM disk mount point does not exist or could not be created.","error":"Error: ENOENT: no such file or directory, mkdir '/Volumes/wpr/myapp/dist'"},{"fix":"Increase the `bytes` option in plugin configuration. Calculate required size: output size (e.g., webpack-bundle-analyzer) + 20% margin.","cause":"The RAM disk size (default 256 MB) is too small for the build output.","error":"Error: ENOSPC: no space left on device, write"},{"fix":"Use: const { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk'); or import { WebpackPluginRamdisk } from 'webpack-plugin-ramdisk';","cause":"Incorrect import: using default import instead of named import, or requiring without destructuring.","error":"Error: WebpackPluginRamdisk is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}