Skip to content

Commit

Permalink
Fix webpack 4 warning (#156)
Browse files Browse the repository at this point in the history
* Fix webpack 4 warning

* Add changelog entry for webpack 4 support
  • Loading branch information
ai authored and valscion committed Feb 23, 2018
1 parent a0bc315 commit 7c09fa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ _Note: Gaps between patch versions are faulty, broken or test releases._

<!-- Add changelog entries for new changes under this section -->

* **Improvement**
* Support webpack 4 without deprecation warnings. @ai in [#156](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/156), fixes [#154](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/154)

## 2.10.0

* **Bug Fix**
Expand Down
10 changes: 8 additions & 2 deletions src/BundleAnalyzerPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BundleAnalyzerPlugin {
apply(compiler) {
this.compiler = compiler;

compiler.plugin('done', stats => {
const done = stats => {
stats = stats.toJson(this.opts.statsOptions);

const actions = [];
Expand All @@ -58,7 +58,13 @@ class BundleAnalyzerPlugin {
actions.forEach(action => action());
});
}
});
};

if (compiler.hooks) {
compiler.hooks.done.tap('webpack-bundle-analyzer', done);
} else {
compiler.plugin('done', done);
}
}

async generateStatsFile(stats) {
Expand Down

0 comments on commit 7c09fa8

Please sign in to comment.