module: recover on statCache failure
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Hey, this is an attempt to resolve the use cases in https://github.com/nodejs/node/issues/31803 and only pay the penalty on unsuccessful loads.
This means that conditional loads are slightly slower (since we attempt them again without the statCache) but all other loads should be as fast and the caching behaviour is less exposed to the user.
I think this is a reasonable tradeoff between not regressing the common pattern of conditional requires while still enabling synchronous resource creation.