webpack-stats-plugin
Advanced tools
Comparing version 1.0.1 to 1.0.2
History | ||
======= | ||
## 1.0.2 | ||
* *Bug*: Fix multiple stats output with `webpack --watch`. | ||
[#59](https://github.com/FormidableLabs/webpack-stats-plugin/issues/59) | ||
## 1.0.1 | ||
@@ -5,0 +10,0 @@ |
@@ -75,2 +75,5 @@ "use strict"; | ||
if (compiler.hooks) { | ||
let emitHookSet = false; | ||
// Capture the compilation and then set up further hooks. | ||
compiler.hooks.thisCompilation.tap("stats-writer-plugin", (compilation) => { | ||
@@ -92,4 +95,10 @@ if (compilation.hooks.processAssets) { | ||
); | ||
} else { | ||
} else if (!emitHookSet) { | ||
// Legacy. | ||
// | ||
// Set up the `compiler` level hook only once to avoid multiple | ||
// calls during `webpack --watch`. (We have to do this here because | ||
// we can't otherwise detect if `compilation.hooks.processAssets` is | ||
// available for modern mode.) | ||
emitHookSet = true; | ||
compiler.hooks.emit.tapPromise("stats-writer-plugin", this.emitStats.bind(this)); | ||
@@ -129,2 +138,3 @@ } | ||
// Finish up. | ||
// eslint-disable-next-line max-statements | ||
.then((statsStr) => { | ||
@@ -157,3 +167,8 @@ // Create simple equivalent of RawSource from webpack-sources. | ||
// Modern method. | ||
curCompiler.emitAsset(filename, source); | ||
const asset = curCompiler.getAsset(filename); | ||
if (asset) { | ||
curCompiler.updateAsset(filename, source); | ||
} else { | ||
curCompiler.emitAsset(filename, source); | ||
} | ||
} else { | ||
@@ -160,0 +175,0 @@ // Fallback to deprecated method. |
{ | ||
"name": "webpack-stats-plugin", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Webpack stats plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19899
171