Skip to content

Commit

Permalink
docs(api): elaborate on custom file system documentation in node.md
Browse files Browse the repository at this point in the history
Resolves #141
  • Loading branch information
skipjack committed Jul 2, 2017
1 parent 97fce1f commit 083a8c9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions content/api/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ webpack({
```


## Compiling to Memory
## Custom File Systems

webpack writes the output to the specified files on disk. If you want webpack to output them to a different kind of file system (memory, webDAV, etc), you can set the `outputFileSystem` option on the compiler:
By default, webpack reads files and writes files to disk using a normal file system. However, it is possible to change the input or output behavior using a different kind of file system (memory, webDAV, etc). To accomplish this, one can change the `inputFileSystem` or `outputFileSystem`. For example, you can replace the default `outputFileSystem` with [`memory-fs`](https://github.com/webpack/memory-fs) to write files to memory instead of to disk:

``` js
const MemoryFS = require("memory-fs");
Expand All @@ -277,4 +277,6 @@ compiler.run((err, stats) => {
});
```

T> The output file system you provide needs to be compatible with Node’s own [`fs`](https://nodejs.org/api/fs.html) module interface, which requires the `mkdirp` and `join` helper methods.
Note that this is what [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware), used by [webpack-dev-server](https://github.com/webpack/webpack-dev-server) and many other packages, uses to mysteriously hide your files but continue serving them up to the browser!

T> The output file system you provide needs to be compatible with Node’s own [`fs`](https://nodejs.org/api/fs.html) interface, which requires the `mkdirp` and `join` helper methods.

0 comments on commit 083a8c9

Please sign in to comment.