The pseudo tapable based on Proxy. tapable-proxy
could create fake hooks which can be tapped even before the creation of real hooks.
$ npm i tapable-proxy
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)
- realHooks
{[string]: Tapable}
the real tapable hooks - clean?
boolean=true
Iftrue
, the tapped handlers will be maintained after applied. Defaults totrue
Set the underlying hooks of the proxy as realHooks
, and after that follop-up taps will directly tap into realHooks
.