Webpack plugins - when to call doResolve and when callback?

Viewed 625

Every webpack resolve plugin follows the following structure:

resolver.plugin(this.source, function(request, callback) {
    if (something) {
         resolver.doResolve(target, obj, "aliased with mapping '" + name + "': '" + ...)
    } else {
         callback(...);
    }

Can anyone please explain when I should call doResolve and when callback. I've found this phrase in the webpack docs:

To pass the request to other resolving plugins, use the this.doResolve(types: String|String[], request: Request, callback) method

However, I don't know what to make of it. It seems that doResolve starts the process from the start. Here is how the stack looks like in doResolve:

enter image description here

You can see that the stages started from the beginning. Why?

1 Answers
Related