Skip to content

Commit

Permalink
Merge pull request #8573 from hulkish/fix-minimizer-fn
Browse files Browse the repository at this point in the history
fix when minimizer is fn
  • Loading branch information
sokra authored Dec 29, 2018
2 parents 983c261 + 6240cf6 commit 69dea22
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/WebpackOptionsApply.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class WebpackOptionsApply extends OptionsApply {
if (options.optimization.minimize) {
for (const minimizer of options.optimization.minimizer) {
if (typeof minimizer === "function") {
minimizer.apply(compiler);
minimizer.call(compiler, compiler);
} else {
minimizer.apply(compiler);
}
Expand Down
1 change: 1 addition & 0 deletions test/configCases/optimization/minimizer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it("should compile", () => {})
18 changes: 18 additions & 0 deletions test/configCases/optimization/minimizer/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const Compiler = require('../../../../lib/Compiler');

module.exports = {
optimization: {
minimize: true,
minimizer: [
{
apply(compiler) {
expect(compiler).toBeInstanceOf(Compiler);
},
},
function(compiler) {
expect(compiler).toBe(this);
expect(compiler).toBeInstanceOf(Compiler);
}
],
},
};

0 comments on commit 69dea22

Please sign in to comment.