{"id":13447887,"url":"https://github.com/shellscape/webpack-plugin-ramdisk","last_synced_at":"2025-04-07T08:18:58.492Z","repository":{"id":47839833,"uuid":"193516435","full_name":"shellscape/webpack-plugin-ramdisk","owner":"shellscape","description":"🐏 A webpack plugin for blazing fast builds on a RAM disk / drive","archived":false,"fork":false,"pushed_at":"2021-08-12T13:57:16.000Z","size":943,"stargazers_count":118,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T06:01:47.216Z","etag":null,"topics":["dev","development","disk","drive","in-memory","memory","ram","ramdisk","ramdrive","webpack"],"latest_commit_sha":null,"homepage":"https://shellscape.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shellscape.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"shellscape","custom":"https://paypal.me/shellscape","liberapay":"shellscape"}},"created_at":"2019-06-24T13:59:30.000Z","updated_at":"2023-12-12T18:03:27.000Z","dependencies_parsed_at":"2022-09-05T16:50:12.065Z","dependency_job_id":null,"html_url":"https://github.com/shellscape/webpack-plugin-ramdisk","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-plugin-ramdisk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-plugin-ramdisk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-plugin-ramdisk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-plugin-ramdisk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellscape","download_url":"https://codeload.github.com/shellscape/webpack-plugin-ramdisk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615385,"owners_count":20967184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dev","development","disk","drive","in-memory","memory","ram","ramdisk","ramdrive","webpack"],"created_at":"2024-07-31T05:01:29.551Z","updated_at":"2025-04-07T08:18:58.471Z","avatar_url":"https://github.com/shellscape.png","language":"JavaScript","readme":"[tests]: \thttps://img.shields.io/circleci/project/github/shellscape/webpack-plugin-ramdisk.svg\n[tests-url]: https://circleci.com/gh/shellscape/webpack-plugin-ramdisk\n\n[cover]: https://codecov.io/gh/shellscape/webpack-plugin-ramdisk/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/shellscape/webpack-plugin-ramdisk\n\n[size]: https://packagephobia.now.sh/badge?p=webpack-plugin-ramdisk\n[size-url]: https://packagephobia.now.sh/result?p=webpack-plugin-ramdisk\n\n[https]: https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener\n[http2]: https://nodejs.org/api/http2.html#http2_http2_createserver_options_onrequesthandler\n[http2tls]: https://nodejs.org/api/http2.html#http2_http2_createsecureserver_options_onrequesthandler\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg width=\"256\" src=\"https://raw.githubusercontent.com/shellscape/webpack-plugin-ramdisk/master/assets/ramdisk.svg?sanitize=true\" alt=\"webpack-plugin-ramdisk\"\u003e\u003cbr/\u003e\u003cbr/\u003e\n\u003c/div\u003e\n\n[![tests][tests]][tests-url]\n[![cover][cover]][cover-url]\n[![size][size]][size-url]\n[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)\n\n# webpack-plugin-ramdisk\n\n🐏 A webpack plugin for blazing fast builds on a RAM disk / drive\n\n\u003ca href=\"https://www.patreon.com/shellscape\"\u003e\n  \u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\"\u003e\n\u003c/a\u003e\n\n_Please consider donating if you find this project useful._\n\n### What It Does\n\nThis plugin will initialize and mount a [RAM disk / drive](https://en.wikipedia.org/wiki/RAM_drive) to enable faster build emitting times. This has advantages over third-party in-memory filesystems in that it uses Node's `fs` module in conjunction with the local system's native capabilities. It's especially useful for projects which need to perform many successive builds, such as during development with Hot Module Reloading enabled. In an HMR scenario, this will also _prevent excessive writes_ to Solid State Drives, preventing the shortening of the drive's lifespan.\n\n## Requirements\n\n`webpack-plugin-ramdisk` is an [evergreen 🌲](./.github/FAQ.md#what-does-evergreen-mean) module.\n\nThis module requires an [Active LTS](https://github.com/nodejs/Release) Node version (v10.0.0+).\n\n## Install\n\nUsing npm:\n\n```console\nnpm install webpack-nano webpack-plugin-ramdisk --save-dev\n```\n\n_Note: We recommend using [webpack-nano](https://github.com/shellscape/webpack-nano), a very tiny, very clean webpack CLI._\n\n## Usage\n\nWhen the plugin is applied during a webpack build, the `output` path specified for a compiler configuration is _appended to the RAMdisk path_. Be sure to choose an appropriate output path!\n\nCreate a `webpack.config.js` file:\n\n```js\nconst { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk');\nconst options = { ... };\n\nmodule.exports = {\n\t// an example entry definition\n\toutput: {\n\t\tpath: '/myapp/dist'  // ← important: this must be an absolute path!\n  }\n  ...\n  plugins: [\n    new WebpackPluginRamdisk(options)\n  ]\n};\n\n```\n\nAnd run `webpack`:\n\n```console\n$ npx wp\n```\n\nYou'll then see that build output has been written to the RAMdisk. In our example above on a MacOS computer, the output path would be `/Volumes/wpr/myapp/dist`.\n\n## Options\n\n### `blockSize`\nType: `Number`\u003cbr\u003e\nDefault: `512`\n\nSets the [block size](https://en.wikipedia.org/wiki/Block_(data_storage)) used when allocating space for the RAMdisk.\n\n### `bytes`\nType: `Number`\u003cbr\u003e\nDefault: `2.56e8`\n\nSets the physical size of the RAMdisk, in bytes. The default value is 256mb. Most builds won't require nearly that amount, and the value can be lowered. For extremely large builds, this value may be increased as needed.\n\n### `name`\nType: `String`\u003cbr\u003e\nDefault: `wpr`\n\nSets the name of the disk/drive/mount point for the RAMdisk. e.g. A value of `batman` would result in a disk root of `/Volumes/batman` on MacOS and `/mnt/batman` on Linux variants.\n\n## API\n\n### `WebpackPluginRamdisk.cleanup(diskPath)`\nParameters: `diskPath` ⇒ `String` The mounted path of the RAMdisk to unmount and remove\n\n`Static`. Provides a convenience method to unmount and remove a RAMdisk created with the plugin.\n\nTo remove the RAMdisk that the plugin created, first obtain the `diskPath` from the plugin:\n\n```js\nconst { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk');\nconst plugin = new WebpackPluginRamdisk(options)\nconst { diskPath } = plugin;\n\nWebpackPluginRamdisk.cleanup(diskPath);\n```\n\n_**Use Caution** as specifying the wrong `diskPath` can have unintended consequences and cause a loss of data. The commands this method utilize can remove other drives as well._\n\n### Linux Users\n\nAutomatic creation of a RAMdisk requires administrative permissions. During the build process you'll be prompted by `sudo` to enter your credentials.\n\n### Windows Users\n\nWindows users that have installed [Windows Subsystem for Linux v2](https://devblogs.microsoft.com/commandline/announcing-wsl-2/) can use the module without issue.\n\nHowever, Windows users without WSL2 are in a pickle. Unfortunately Windows does not ship with any capabilities that allow for creation of RAM disks / drives programmatically, without user interaction. This is an OS limitation and we cannot work around it. However, there is a solution for Windows users - tools like [ImDisk](https://sourceforge.net/projects/imdisk-toolkit/) will allow you to create a RAMdisk and assign it a drive letter, to which one can point a webpack configuration's `output` property.\n\n## Performance\n\nAverage savings for a bundle's total build time ranges from 25-32% according to tests we've run on a variety of platforms and bundle sizes. The largest gains were during frequently Hot Module Reloading operations, where one or more files were changed and the bundle(s) were rebuilt during watch mode.\n\nFor example, the following stats were generated for a 13mb bundle:\n\nWithout `webpack-plugin-ramdisk`:\n - initial build and emit: 19.88s\n - initial file change, save, and rebuild: 0.6s\n - subsequent changes and rebuilds: 1.15s 0.864s 1.68s\n\nAverage build and emit time: 1.23s\n\nWith `webpack-plugin-ramdisk`:\n - initial build and emit: 16.8s\n - initial file change, save, and rebuild: 0.9s\n - subsequent changes and rebuilds: 1.23s, 0.951s, 0.48s\n\nAverage build and emit time: 0.887s\n\nResult = 28% time savings. This may seem inconsequential, but consider the number of times a single developer will save and rebuild for HMR during the course of a workday. When aggregated, that's a considerable savings throughout a session.\n\n## Removing the RAMdisk\n\n_These commands use `wpr` as the RAMdisk name. If the `name` option has been modified, swap `wpr` for the value specified in the options._\n\nOn MacOS:\n\n```console\n$ umount /Volumes/wpr\n$ hdiutil detach /Volumes/wpr\n```\n\nOn Linux:\n\n```console\n$ sudo umount /mnt/wpr\n```\n\n## Meta\n\n[CONTRIBUTING](./.github/CONTRIBUTING.md)\n\n[LICENSE (Mozilla Public License)](./LICENSE)\n","funding_links":["https://patreon.com/shellscape","https://paypal.me/shellscape","https://liberapay.com/shellscape","https://www.patreon.com/shellscape"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellscape%2Fwebpack-plugin-ramdisk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellscape%2Fwebpack-plugin-ramdisk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellscape%2Fwebpack-plugin-ramdisk/lists"}