Skip to content

Commit

Permalink
Merge pull request #8405 from xiaoxiaojx/fix-function-plugin-apply
Browse files Browse the repository at this point in the history
fix parameter missing  when plugin type is a funtion
  • Loading branch information
sokra committed Nov 29, 2018
2 parents 8e841fe + 70b9a1b commit e3e8a68
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions declarations/WebpackOptions.d.ts
Expand Up @@ -225,6 +225,7 @@ export type ArrayOfStringOrStringArrayValues = (string | string[])[];
* via the `definition` "WebpackPluginFunction".
*/
export type WebpackPluginFunction = (
this: import("../lib/Compiler"),
compiler: import("../lib/Compiler")
) => void;
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/webpack.js
Expand Up @@ -42,7 +42,7 @@ const webpack = (options, callback) => {
if (options.plugins && Array.isArray(options.plugins)) {
for (const plugin of options.plugins) {
if (typeof plugin === "function") {
plugin.apply(compiler);
plugin.call(compiler, compiler);
} else {
plugin.apply(compiler);
}
Expand Down
2 changes: 1 addition & 1 deletion schemas/WebpackOptions.json
Expand Up @@ -1879,7 +1879,7 @@
"WebpackPluginFunction": {
"description": "Function acting as plugin",
"instanceof": "Function",
"tsType": "(compiler: import('../lib/Compiler')) => void"
"tsType": "(this: import('../lib/Compiler'), compiler: import('../lib/Compiler')) => void"
},
"WebpackPluginInstance": {
"description": "Plugin instance",
Expand Down

0 comments on commit e3e8a68

Please sign in to comment.