diff --git a/middleware.js b/middleware.js index abb61f690..098130a7d 100644 --- a/middleware.js +++ b/middleware.js @@ -53,7 +53,13 @@ module.exports = function(compiler, options) { if(typeof options.reporter !== "function") options.reporter = defaultReporter; // store our files in memory - var fs = compiler.outputFileSystem = new MemoryFileSystem(); + var fs; + var isMemoryFs = compiler.outputFileSystem instanceof MemoryFileSystem; + if(isMemoryFs) { + fs = compiler.outputFileSystem; + } else { + fs = compiler.outputFileSystem = new MemoryFileSystem(); + } compiler.plugin("done", function(stats) { // We are now on valid state