Goal
I'm trying to personalize the webpack output to add some information when requiring a module like if the module is currently loading or already loaded (webpack_require).
Currently i'm patching the webpack_require at asset level creating a new ConcatSource, but this is a short term solution.
How can i manipulate the webpack emitted code (not the .ts/.js original files,just the module entry code and other webpack glue) in a safe and efficient way?
Usage
This is required to create a zero configuration module discovery (discover and inject Nestjs stuff automatically) that support circular dependence.
I tried to look around and found this: https://github.com/adierkens/webpack-inject-plugin but is unmaintained and it's not working anymore.