tapable
tapable copied to clipboard
.tap() `before` parameter do not respects existing befores
Hello. I have three plugins:
Adepends onBBdepends onCC
They tap some hook with same stage in the following order:
A, B, C
Then inside https://github.com/webpack/tapable/blob/9d647f86ddb2930c6e24950a1edd2778453e92a1/lib/Hook.js#L136 they got position incorrectly as:
B, A, C
It happens because current logic looks like:
- Adding
A, no taps, just add - Adding
B,Bhasbefore, soif (before.size > 0)allows to skipAand be inserted in the start oftaps(e.g. order now isB, A) - Adding
Cto the top, since it has nobeforerules
Also it's will be good to throw exception if circular dependency is detected.