New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in 5.69.0: result is not iterable #15409
Comments
cc @vankop, since it looks like you're pretty familiar with this code! |
@nwalters512 |
@nwalters512 Could you reduce repro to this resolve request? steps to reduce:
|
@vankop Thanks for taking a look! I was ultimately able to isolate the parts that are causing problems: https://github.com/nwalters512/webpack-resolver-cache-plugin-bug-repro. Please follow the instructions in the README to reproduce. In doing so, I realized that the error only occurs with a custom webpack plugin that we use to deduplicate dependencies, which is located at |
Bug report
What is the current behavior?
When I try to build my application, it fails with the following error message and stack trace:
If the current behavior is a bug, please provide the steps to reproduce.
Unfortunately, I don't understand enough of webpack's internals to even begin to try to reproduce this error in isolation. I also can't share the app or config directly, as they're internal to my company. I did do some investigation via
console.log
statements insideResolverCachePlugin.js
, which I'll share here.The error in the above stack trace is thrown on this line:
webpack/lib/cache/ResolverCachePlugin.js
Line 248 in 9d21401
If I look at the value of
result
when it fails, I see that indeed it is an object, not an array (or any other kind of iterable).I added the following logs below this line in
ResolverCachePlugin.js
:I noticed that the vast majority of the
identifier
values start withnormal|default|
, but theidentifier
associated with the failing stack trace starts withcontext|yield
. This makes sense, as this occurs inside thewithYield
branch of code:webpack/lib/cache/ResolverCachePlugin.js
Line 232 in 9d21401
I followed the stack trace back to this line of code:
webpack/lib/cache/ResolverCachePlugin.js
Line 163 in 9d21401
If I log there, I see that both
result
andyieldResult
are defined.yieldResult
is an empty array, andresult
is an object. I suspect that this is the root of the problem: thedone
callback seems to expect that for any resolver that iswithYield
, that the result will be an iterable, butresolveResult
(which is ultimately passed todone
) is actually an object in this case.This code was recently modified in #15332, including the addition of the
const resolveResult = result || yieldResult;
code, so I'm pretty confident that this regression can be traced back to that PR.I sincerely apologize that I'm unable to provide a reproduction, and I'd be happy to answer any questions about the structure or specific nature of my project.
What is the expected behavior?
I would expect to not see this error. On webpack 5.68.0 and previous versions (all the way back to v4), I did not see this error.
Other relevant information:
webpack version: 5.69.0
Node.js version: 16.13.1
Operating System: macOS
The text was updated successfully, but these errors were encountered: