This is a followup to #174. In this PR, we've implemented normalize-options.js as a way for third-party runtimes to hook into resolve by default and modify its default options.
It worked really well, and unlocked many packages - Babel being an important one. I just found out, however, that it doesn't work with one particular project: Next.js. For some reason, Next precompiles resolve and thus causes normalize-options.js to disappear, leaving no chance to the hook to override it.
There are a few options to solve that on their side, but I wonder: could/should resolve improve its support? Since 2018 a lot of new projects have adopted PnP, including enhanced-resolve from Webpack. Coupled to the fact that:
- This behaviour is in essence already enabled by default for everyone using PnP
- It doesn't affect at all people that don't use PnP
- The PnP API has been very stable for a while now
- PnP will be the default in Yarn 2+
How would you feel about adding the PnP logic into resolve itself if process.versions.pnp is detected (we would still have forceNodeResolution to prevent it, just like it is at the moment)?
This is a followup to #174. In this PR, we've implemented
normalize-options.jsas a way for third-party runtimes to hook intoresolveby default and modify its default options.It worked really well, and unlocked many packages - Babel being an important one. I just found out, however, that it doesn't work with one particular project: Next.js. For some reason, Next precompiles
resolveand thus causesnormalize-options.jsto disappear, leaving no chance to the hook to override it.There are a few options to solve that on their side, but I wonder: could/should
resolveimprove its support? Since 2018 a lot of new projects have adopted PnP, includingenhanced-resolvefrom Webpack. Coupled to the fact that:How would you feel about adding the PnP logic into
resolveitself ifprocess.versions.pnpis detected (we would still haveforceNodeResolutionto prevent it, just like it is at the moment)?