Registry / devops / webpack-plugin-ramdisk

webpack-plugin-ramdisk

JSON →
library0.2.0jsnpmunverified

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.

npm install webpack-plugin-ramdisk
INSTALL
IMPORT
SIG · WEBPACK-PLUGIN-RAM
W
webpack-plugin-ramdisk
devopsjavascriptv0.2.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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebpackPluginRamdisk
const { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk')
const WebpackPluginRamdisk = require('webpack-plugin-ramdisk')
Always use the named export via destructuring. Requires() is the only supported import style in this package (no ESM).
WebpackPluginRamdisk
import { WebpackPluginRamdisk } from 'webpack-plugin-ramdisk'
import WebpackPluginRamdisk from 'webpack-plugin-ramdisk'
ESM imports are supported in modern Node versions, but must use named import syntax. Default import will fail.
WebpackPluginRamdisk.cleanup
const { cleanup } = require('webpack-plugin-ramdisk').WebpackPluginRamdisk
const { cleanup } = require('webpack-plugin-ramdisk')
cleanup is a static method on the class, not a separate export. Access via the class symbol or require the class then destructure.

Basic Webpack configuration using the RAM disk plugin with output path and plugin options.

const path = require('path'); const { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk'); module.exports = { output: { path: '/myapp/dist' }, plugins: [ new WebpackPluginRamdisk({ blockSize: 512, bytes: 2.56e8, name: 'wpr' }) ] };
Debug
Known issues
gotchaThe 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.
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.
affects: >=0.1.0
gotchaThe 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.
fix
Use alternative in-memory filesystem like memfs or webpack-virtual-modules for cross-platform builds.
affects: >=0.1.0
gotchaThe 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.
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.
affects: >=0.1.0
gotchaLarge 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.
fix
Increase the `bytes` option to accommodate your build output size. Use process.memoryUsage() or estimate output size.
affects: >=0.1.0
gotchaThe 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).
fix
Call WebpackPluginRamdisk.cleanup(diskPath) manually in your script's exit handler (e.g., process.on('exit', ...)).
affects: >=0.1.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, mkdir '/Volumes/wpr/myapp/dist'
The RAM disk mount point does not exist or could not be created.
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.
Error: ENOSPC: no space left on device, write
The RAM disk size (default 256 MB) is too small for the build output.
fix
Increase the `bytes` option in plugin configuration. Calculate required size: output size (e.g., webpack-bundle-analyzer) + 20% margin.
Error: WebpackPluginRamdisk is not a constructor
Incorrect import: using default import instead of named import, or requiring without destructuring.
fix
Use: const { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk'); or import { WebpackPluginRamdisk } from 'webpack-plugin-ramdisk';
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
webpackrequiredPeer dependency; plugin hooks into Webpack compilation lifecycle
Agent activity
6 hits · last 30 days
node
6
Resources
webpack-plugin-ramdisk — npm install webpack-plugin-ramdisk · libregistry