This stuff seems to be undocumented:

but yarn pnp does it:

and linaria does it:

yarn pnp

yarn includes some documentation about the usage of PNP that might be relatable to the internals of module loading. It mentions three alternative resolution packages in wide use, two of which work with PNP’s alternate resolution and one of which is typescript.

    • enhanced-resolve is webpack’s algo. I used it to build Gatsby’s component shadowing too.