Fix - populate separate cache for require(esm) is a breaking change
Version
24.8.0
Platform
Subsystem
No response
What steps will reproduce the bug?
In webpack we cache build dependencies (and nested require in any deps) and use this logic before (sinplified):
const module = require.cache[path]; if (module) { // it is a common js module // we go through children and then also for their children and etc } else if (/\.m?js$/.test(path)) { // it is ES modules or something else // here we use `es-module-lexer` to get all `import`s }
Now this logic is broken, not only webpack uses this logic, it can break more tools
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
This change should be a part of the next major release, not minor
What do you see instead?
Logic is broken
Additional information
Ref - #59679