tapable-proxy
v1.0.4
Published
The pseudo tapable based on Proxy
Downloads
3
Readme
tapable-proxy
The pseudo tapable based on Proxy. tapable-proxy
could create fake hooks which can be tapped even before the creation of real hooks.
Install
$ npm i tapable-proxy
Usage
const {
create,
APPLY_TAPS,
SET_HOOKS
} = require('tapable-proxy')
// Create a fake hook proxy
const hooks = create()
hooks.afterEmit.tap('MyPlugin', compilation => {
// ...
})
// Apply all taps to webpack compiler hooks
hooks[APPLY_TAPS](compiler.hooks)
// Proxy the follow-up taps to compiler hooks
hooks[SET_HOOKS](compiler.hooks)
hooks[APPLY_TAPS](realHooks, clean)
- realHooks
{[string]: Tapable}
the real tapable hooks - clean?
boolean=true
Iftrue
, the tapped handlers will be maintained after applied. Defaults totrue
hooks[SET_HOOKS](realHooks)
Set the underlying hooks of the proxy as realHooks
, and after that follop-up taps will directly tap into realHooks
.