Skip to content

Commit

Permalink
fix parameter missing when plugin type is a funtion
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiaojx committed Nov 26, 2018
1 parent a230148 commit 70b9a1b
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 70b9a1b

Please sign in to comment.