Open
requested to merge github/fork/bluenote10/bugfix/attempt_to_fix_custom_loader_race_condition into main
Created by: bluenote10
This is perhaps the most naive way to fix #10871 #10315 #8707 (closed).
The idea is to make sure only one promise is created. See #10871 for details on the race condition.
I'm not an expert in webpack/fork-ts-checker-webpack-plugin and the semantics of the beforeCompile vs afterTypeScriptCheck are not entirely clear to me. In particular why beforeCompile can be called multiple times with custom loaders, but afterTypeScriptCheck is always called once. Nonetheless, the idea of the code is probably just to set a pending promise on the very first beforeCompile call, and complete it after the compilation. Since there aren't multiple calls to afterTypeScriptCheck anyway, this simple fix may be sufficient.