Plugins are an easy way to extend core webpkr functionality:
Provide specialized script blocks (e.g. EnvPlugin
provides environment script blocks).
Tap into the build cycle.
Extend or mutate build objects.
Base class from which plugins are derived.
name |
|
The plugin’s name. |
Gets the builder with which this plugin is registered.
returns |
|
the builder. |
Gets the plugin’s name.
returns |
|
the plugin’s name. |
Called after all nodes are evaluated with the webpack
configuration generated during the configuration phase.
value |
|
Webpack configuration object. |
returns |
|
The configuration object (original or mutated). |
The plugin can mutate the object and must return either the original or the mutated value. Plugins are called sequentially, the next receiving the value returned from the prior and the value returned from the final plugin is returned to the caller.
Called after each node is evaluated with the node and the result of evaluating the node.
node |
|
node that was just evaluated. |
value |
|
result of evaluating the node. |
returns |
|
the evaluated value (original or mutated). |
The plugin may mutate the object and must return either the original or the mutated value. Plugins are called sequentially, the next receiving the value returned from the prior and the value returned from the final plugin is set on the node as the result of evaluation.
Called before each node is evaluated with the node.
node |
|
node that is due for evaluation. |
returns |
|
none. |
Called during initialization to allow the plugin to register global objects such as custom script blocks.
returns |
|
none |
Returns true if the specified node should be considered during evaluation.
node |
|
the node to be evaluated. |
returns |
|
true if the node should be evaluated, else false. |
Called during cleanup to allow the plugin to release any global objects.
returns |
|
none |
Emitted by the plugin after it’s registered with a builder. This is a good time to listen to events on the builder.