webpack-virtual-modules
Advanced tools
Comparing version
26
index.js
var VirtualStats = require('./virtual-stats'); | ||
var RawSource = require("webpack-sources").RawSource; | ||
var path = require('path'); | ||
@@ -50,5 +49,2 @@ var debug = require('debug')('webpack-virtual-modules'); | ||
self._timestamps = self._timestamps || {}; | ||
self._timestamps[modulePath] = time; | ||
debug(self._compiler.name, "Write module:", modulePath, contents); | ||
@@ -103,26 +99,4 @@ | ||
}); | ||
compiler.plugin("compilation", function(compilation) { | ||
compilation.plugin("seal", function() { | ||
self._sealTime = Date.now(); | ||
debug(compiler.name, "seal"); | ||
}); | ||
compilation.plugin("after-seal", function(callback) { | ||
debug(compiler.name, "after-seal"); | ||
if (self._timestamps) { | ||
compilation.modules.forEach(function(module) { | ||
var time = self._timestamps[module.resource]; | ||
if (time && time > self._sealTime) { | ||
var contents = compiler.inputFileSystem.readFileSync(module.resource).toString(); | ||
debug(compiler.name, "Replacing module:", module.resource, contents); | ||
module._source = new RawSource(contents); | ||
} | ||
}); | ||
} | ||
callback(); | ||
}); | ||
}); | ||
}; | ||
module.exports = VirtualModulesPlugin; |
{ | ||
"name": "webpack-virtual-modules", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Webpack Virtual Modules", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -72,6 +72,2 @@ ## Webpack Virtual Modules | ||
If `writeModule` happens after `seal` phase, but before `after-seal` phase the module contents will be replaced as is, | ||
without using loaders. This is supported to let one update dynamic module contents when compilation has been finished | ||
already. | ||
## Inspiration | ||
@@ -78,0 +74,0 @@ This project is inspired by: https://github.com/rmarscher/virtual-module-webpack-plugin |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
-100%9136
-11.19%159
-12.64%80
-4.76%