webpack-virtual-modules
Advanced tools
+17
-7
@@ -53,3 +53,3 @@ var VirtualStats = require('./virtual-stats'); | ||
| // wrappers, giving us access to the "real" watchFileSystem. | ||
| let finalWatchFileSystem = self._watcher && self._watcher.watchFileSystem; | ||
| var finalWatchFileSystem = self._watcher && self._watcher.watchFileSystem; | ||
@@ -60,3 +60,8 @@ while (finalWatchFileSystem && finalWatchFileSystem.wfs) { | ||
| self._compiler.inputFileSystem._writeVirtualFile(modulePath, stats, contents); | ||
| var finalInputFileSystem = self._compiler.inputFileSystem; | ||
| while (finalInputFileSystem && finalInputFileSystem._inputFileSystem) { | ||
| finalInputFileSystem = finalInputFileSystem._inputFileSystem; | ||
| } | ||
| finalInputFileSystem._writeVirtualFile(modulePath, stats, contents); | ||
| if (finalWatchFileSystem && finalWatchFileSystem.watcher.fileWatchers.length) { | ||
@@ -94,6 +99,11 @@ finalWatchFileSystem.watcher.fileWatchers.forEach(function(fileWatcher) { | ||
| var afterEnvironmentHook = function() { | ||
| if (!compiler.inputFileSystem._writeVirtualFile) { | ||
| var originalPurge = compiler.inputFileSystem.purge; | ||
| var finalInputFileSystem = compiler.inputFileSystem; | ||
| while (finalInputFileSystem && finalInputFileSystem._inputFileSystem) { | ||
| finalInputFileSystem = finalInputFileSystem._inputFileSystem; | ||
| } | ||
| compiler.inputFileSystem.purge = function() { | ||
| if (!finalInputFileSystem._writeVirtualFile) { | ||
| var originalPurge = finalInputFileSystem.purge; | ||
| finalInputFileSystem.purge = function() { | ||
| originalPurge.apply(this, arguments); | ||
@@ -108,3 +118,3 @@ if (this._virtualFiles) { | ||
| compiler.inputFileSystem._writeVirtualFile = function(file, stats, contents) { | ||
| finalInputFileSystem._writeVirtualFile = function(file, stats, contents) { | ||
| this._virtualFiles = this._virtualFiles || {}; | ||
@@ -120,3 +130,3 @@ this._virtualFiles[file] = {stats: stats, contents: contents}; | ||
| try { | ||
| compiler.inputFileSystem.readdirSync(dir); | ||
| finalInputFileSystem.readdirSync(dir); | ||
| } catch (e) { | ||
@@ -123,0 +133,0 @@ var time = Date.now(); |
+1
-1
| { | ||
| "name": "webpack-virtual-modules", | ||
| "version": "0.2.1", | ||
| "version": "0.2.2", | ||
| "description": "Webpack Virtual Modules", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
14242
2.77%238
3.48%