Error using interception API with SyncBailHook
See original GitHub issueHere is a simple configuration I had while linked up to webpack#next
webpack.config.js
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './src',
output: {
path: path.join(__dirname, 'dist'),
filename: 'chunk.js'
},
plugins: [
new webpack.ProgressPlugin(),
function () {
const compiler = this;
Object.keys(compiler.hooks).forEach((hookName) => {
compiler.hooks[hookName].intercept(interceptorFor(hookName));
});
}
]
};
const interceptorFor = (hookName) => ({
call: (...args) => {
console.log(`Intercepting Call: ${hookName}\n Args: ${JSON.stringify([...args])}`);
},
tap: (tapDetails) => {
console.log(`Intercepting Tap: ${JSON.stringify(tapDetails)}`);
}
});
This is the error that threw:
console output
TypeError: Cannot read property 'fn' of undefined
at SyncBailHook.eval [as call] (eval at compile (/mnt/c/Users/selarkin/Code/webpack/node_modules/tapable/lib/Hook.js:21:10), <anonymous>:12:28)
at SyncBailHook.eval [as _call] (eval at createCompileDelegate (/mnt/c/Users/selarkin/Code/webpack/node_modules/tapable/lib/Hook.js:55:10), <anonymous>:5:16)
at WebpackOptionsApply.process (/mnt/c/Users/selarkin/Code/webpack/lib/WebpackOptionsApply.js:264:30)
at webpack (/mnt/c/Users/selarkin/Code/webpack/lib/webpack.js:35:48)
at processOptions (/mnt/c/Users/selarkin/Code/webpack/bin/webpack.js:357:15)
at yargs.parse (/mnt/c/Users/selarkin/Code/webpack/bin/webpack.js:418:2)
at Object.Yargs.self.parse (/mnt/c/Users/selarkin/Code/webpack/node_modules/yargs/yargs.js:533:18)
at Object.<anonymous> (/mnt/c/Users/selarkin/Code/webpack/bin/webpack.js:154:7)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Writing a Plugin - webpack
This allows to intercept absolutely all the assets which are part of the compilation. However, in our example we are fine with using...
Read more >TS: Proxy function call interception error - Stack Overflow
For this, i create Proxy for Api class instance, and try to intercept. It's need to redirect to login page if user Unauthenticated...
Read more >tapable-ts - NPM Package Overview - Socket - Socket.dev
Start using Socket to analyze tapable-ts and its 0 dependencies to secure your ... The intercept API closely resembles the original tapable implementation....
Read more >@pawjs/tapable NPM | npm.io
The tapable package expose many Hook classes, which can be used to create hooks for plugins. const { SyncHook, SyncBailHook, SyncWaterfallHook, SyncLoopHook ...
Read more >node_modules/tapable/README.md - VIsioIMB_API - PLMlab
const { SyncHook, SyncBailHook, SyncWaterfallHook, SyncLoopHook, AsyncParallelHook, ... All Hooks offer an additional interception API:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It should be:
Closing as was a difference in understanding on my part. Updated docs in merge.