Skip to content

problem about tap method of interceptor #78

Open
@warjiang

Description

@warjiang

recently i try to use interceptor of tapable, in the Interception section of readme:

tap: (tap: Tap) => void Adding tap to your interceptor will trigger when a plugin taps into a hook. Provided is the Tap object. Tap object can't be changed.

it means if i use a intecptor of tap method, when a plugin taps into a hook, the corresponding function will be invoked. However, the following code snippet does not work as expected.

code snippet:

const { SyncBailHook } = require('tapable')
const hook = new SyncBailHook(['name'])
hook.intercept({
    tap:(tapInfo) => {
        console.log(tapInfo)
    }
})
hook.tap('1', function (name) {
    console.log(name, '1')
})
hook.tap('2', function (name) {
    console.log(name, '2')
    return 'wrong'
})
hook.tap('1', function (name) {
    console.log(name, '2')
})

tap of interceptor only be called when it execute hook.call('webpack').

version of tapable: 1.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions