loaders icon indicating copy to clipboard operation
loaders copied to clipboard

expose defaultLoad and defaultResolve in middleware

Open hardfist opened this issue 3 years ago • 3 comments

It seem that chaining hooks replace defaultLoad | defaultResolve with next handle , which make it's not possible access defaultLoad and defaultResolve, which is useful for some case. I'm wondering could defaultLoad and defaultResolve be exposed to context.

hardfist avatar May 31 '22 05:05 hardfist

It's possible to access default<HookName> at the end of the chain:

--loader b.mjs --loader a.mjs

nextResolve in A will be B, and then nextResolve in B will be defaultResolve.

A loader should defer to next (and thus eventually default) when it can't handle whatever, so A can access defaultResolve through B.

JakobJingleheimer avatar May 31 '22 19:05 JakobJingleheimer

but i want to skip other middleware and just use the defaultLoad and defaultResolve,and use it like utils

hardfist avatar May 31 '22 22:05 hardfist

What's the use case? I can see why accessing the first loader is useful (to reset the resolution), but I don't immediately see why the last one is 🤔

arcanis avatar Jun 01 '22 06:06 arcanis