File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ function ConsoleLogOnBuildWebpackPlugin() {
22
22
};
23
23
24
24
ConsoleLogOnBuildWebpackPlugin .prototype .apply = function (compiler ) {
25
- compiler .plugin (' run' , function (compiler , callback ) {
25
+ compiler .plugin (' run' , function (compilation , callback ) {
26
26
console .log (" The webpack build process is starting!!!" );
27
27
28
28
callback ();
Original file line number Diff line number Diff line change @@ -17,6 +17,30 @@ For more information on `Tapable` visit the [tapable repository](https://github.
17
17
18
18
## Creating a Plugin
19
19
20
-
20
+ A plugin for ` webpack ` consists of
21
+
22
+ - A named JavaScript function.
23
+ - Defines ` apply ` method in it's prototype.
24
+ - Specifies webpack's event hook to attach itself.
25
+ - Manipulates webpack internal instance specific data.
26
+ - Invokes webpack provided callback after functionality is complete.
27
+
28
+ ``` javascript
29
+ // A named JavaScript function.
30
+ function MyExampleWebpackPlugin () {
31
+
32
+ };
33
+
34
+ // Defines `apply` method in it's prototype.
35
+ MyExampleWebpackPlugin .prototype .apply = function (compiler ) {
36
+ // Specifies webpack's event hook to attach itself.
37
+ compiler .plugin (' webpacksEventHook' , function (compilation /* Manipulates webpack internal instance specific data. */ , callback ) {
38
+ console .log (" This is an example plugin!!!" );
39
+
40
+ // Invokes webpack provided callback after functionality is complete.
41
+ callback ();
42
+ });
43
+ };
44
+ ```
21
45
22
46
### Different Plugin Shapes
You can’t perform that action at this time.
0 commit comments