Skip to content

Commit 69dea22

Browse files
authored
Merge pull request #8573 from hulkish/fix-minimizer-fn
fix when minimizer is fn
2 parents 983c261 + 6240cf6 commit 69dea22

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

lib/WebpackOptionsApply.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ class WebpackOptionsApply extends OptionsApply {
463463
if (options.optimization.minimize) {
464464
for (const minimizer of options.optimization.minimizer) {
465465
if (typeof minimizer === "function") {
466-
minimizer.apply(compiler);
466+
minimizer.call(compiler, compiler);
467467
} else {
468468
minimizer.apply(compiler);
469469
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
it("should compile", () => {})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const Compiler = require('../../../../lib/Compiler');
2+
3+
module.exports = {
4+
optimization: {
5+
minimize: true,
6+
minimizer: [
7+
{
8+
apply(compiler) {
9+
expect(compiler).toBeInstanceOf(Compiler);
10+
},
11+
},
12+
function(compiler) {
13+
expect(compiler).toBe(this);
14+
expect(compiler).toBeInstanceOf(Compiler);
15+
}
16+
],
17+
},
18+
};

0 commit comments

Comments
 (0)