-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix(webpack-preprocessor): hanging issues with webpack 5 #15611
Conversation
Thanks for taking the time to open a PR!
|
dea0192
to
d3c6049
Compare
Thanks for you work on this. Sorry for the delay in reviewing it. I think your approach is probably the way to go. I don't think there should be any risk of getting an old version of the file since all the promises will resolve with the same path and since they resolve after the latest compile has finished, the latest version of the file will be served to any client that has the older or newer promise. We definitely need a few tests around this. One for the fix itself, one that verifies the deferred array gets cleared when compile succeeds, and one that verifies the deferred array gets cleared when compile fails. |
@lukeapage Will you have time to add a test and address the questions from the PR review? Thanks for the work again. |
Been a bit busy recently and we have a workaround so this hasn’t been a top priority. I will try to make time soon. |
should I go back to webpack 4 or you are about to merge this fix? thank you! |
How does this interact with #16493 by @lmiller1990 (which claims "can use with webpack v5")? |
Different things. This fixes a intermittent issue that occurs with webpack 5. |
I am a bit curious around the change relating to Either way, I can pick this up. How did you recreated and test this issue @lukeapage? I haven't encountered it in my projects that use webpack 5 (those are pretty trivial projects, though). Did you use the repository provided in this comment? |
Hey @initplatform, I would really like to iron out the webpack 5 problems. Can you share a repo that reproduces this issue? It's not entirely clear if this will fix the issue for everyone. Alternatively, does this PR fix the problem for you (if you cannot share your code base). Could you try it out locally? You could just modify the code in If there is a reliable way to reproduce this issue in a minimal repo, that'd be great, too. |
Hey @lmiller1990 I can't share the code, and not sure if I can reproduce it easily in a fresh project, but I gonna try the modifications locally this week-end, |
@lmiller1990 Unfortunately I am unable to post the project, and not sure entirely how I would recreate it... However, I did take your changes and try them out and they do work! I didn't want to piece together the transpiled typescript, so I checked out cypress and built it with your changes. @xgehl, If you want to try out the changes, just put the file from this gist into https://gist.github.com/initplatform/e2353db94c1270b89eaa07740a4b44c0 |
@lmiller1990 I've tried the changes (thanks @initplatform for the file), and I can confirm it's working ! |
I noticed an exception getting raised in the tests. I added this defensive check. Specifically it was this test that was raising an exception. Not sure if this fix is correct - may need to dive deeper into this part of the code base to really grok what's going on. I merged in develop, and added some unit tests as requested by @chrisbreiding. I'd appreciate another set of eyes @chrisbreiding - do you see any more thorough way to test this change, or any edge cases? |
Thanks for helping to finish this @lmiller1990 |
Ok @chrisbreiding taking a different approach, since I don't see a good way to easily update the preprocessor to run on webpack 5, but everything else run with webpack 5. Have a look at this file. It will update It works fine, but the trade off is it adding some technical debt (this script). Mid term, I'd like to upgrade all of Cypress to use webpack 5. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Nice solution.
I agree we should revisit in the future to get the rest of the codebase on webpack 5 and add proper testing in this package for webpack 4, since we still support it.
|
The changes here somehow lead to this error getting thrown in the plugins process. It now manifests in the launcher - it should be in the runner. That's what the It's because we are rejecting everything here. I am not sure how best to solve this... 🤔 . On develop we end up calling this part of the code which does not happen after this change. This is where things change. In develop we correctly reject the promise and catch it; in this branch, we don't. |
Ok... found a fix (kind of). Bit of a hack, but we resolve every bundle for a successful compilation. For an error, we only want one rejection, so we just reject the last bundle. Tests passing, did a bit of testing by hand too, and seems to be working. This doesn't feel ideal, but I don't have another solution right now. Let me know what you think @chrisbreiding. |
I agree it's not ideal, but I can't think of another solution either. |
@chrisbreiding @jennifer-shehane the bug this resolves has just been closed with a note that it’s released but as this is in a different package, it is actually not released yet. The issue is locked so I cannot bring it up there. |
Looks like this was released 6 hours ago (8 hours after your post) via semantic release @lukeapage. |
User facing changelog
Additional details
#15447 (comment)
I'm not sure what the best fix is - this approach at least means that you will not get promises hanging. I don't know if it could in some circumstances cause an old version of the file to be served.
I'm unsure on whether tests are required - I would at least like to hear an opinion on the approach first.
PR Tasks