GeezerVison is showing github.com — Merge pull request #8405 from xiaoxiaojx/fix-function-plugin-apply · webpack/webpack@e3e8a68
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: declarations/WebpackOptions.d.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -225,6 +225,7 @@ export type ArrayOfStringOrStringArrayValues = (string | string[])[]; |
225 | 225 | * via the `definition` "WebpackPluginFunction". |
226 | 226 | */ |
227 | 227 | export type WebpackPluginFunction = ( |
| 228 | + this: import("../lib/Compiler"), |
228 | 229 | compiler: import("../lib/Compiler") |
229 | 230 | ) => void; |
230 | 231 | /** |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/webpack.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -42,7 +42,7 @@ const webpack = (options, callback) => { |
42 | 42 | if (options.plugins && Array.isArray(options.plugins)) { |
43 | 43 | for (const plugin of options.plugins) { |
44 | 44 | if (typeof plugin === "function") { |
45 | | - plugin.apply(compiler); |
| 45 | + plugin.call(compiler, compiler); |
46 | 46 | } else { |
47 | 47 | plugin.apply(compiler); |
48 | 48 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: schemas/WebpackOptions.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1879 | 1879 | "WebpackPluginFunction": { |
1880 | 1880 | "description": "Function acting as plugin", |
1881 | 1881 | "instanceof": "Function", |
1882 | | - "tsType": "(compiler: import('../lib/Compiler')) => void" |
| 1882 | + "tsType": "(this: import('../lib/Compiler'), compiler: import('../lib/Compiler')) => void" |
1883 | 1883 | }, |
1884 | 1884 | "WebpackPluginInstance": { |
1885 | 1885 | "description": "Plugin instance", |
|