Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Webpack 5 Upgrade #22267
Webpack 5 Upgrade #22267
Changes from 5 commits
d4126d7
22813af
f79e01d
1c2da66
b1b7622
5770b68
97686ff
d50af18
13f3bd6
3ab20d4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Something about this change causes the following error to be thrown in the extension process:
Looking at the code in question, I see:
Seems like this is coming from an imported module?
Seems like the result of this error is that the named hooks feature does not work. (Clicking the little "🪄" button for an inspected element eventually times out whereas it used to work.)
To reproduce this problem, build the extension as described here and then open a website like Code Sandbox and try to inspect a component with hooks. (You can see the error thrown when the extension is initializing actually, by undocking the DevTools and opening a second level of DevTools to inspect the extension.)
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.
will look into this further
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.
🙇🏼♂️ Thanks!
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.
The
react-devtools-shell
test app is broken by this change. (I think actually it's thereact-devtools-inline
package that gets broken, but I'll explain that below.)Looks like the page is trying to request
/dist/devtools.js
and it's getting a 400 response. (Interestingly, the page is also requesting/devtools.js
and that's returning okay.)Editing the
index.html
file so the<script>
tag loads/devtools.js
instead (no/dist/...
) fixes the failed network requests, but still doesn't fix the broken shell.I see the following error in the console:
I also see a few (related?) warnings in the console when running the test shell:
Inspecting the imported module, it looks like there's an extra
backend
wrapper now, e.g.Whereas before it was:
This behavior can be reproduced by following the steps here:
https://github.com/facebook/react/blob/main/packages/react-devtools/CONTRIBUTING.md#option-1-fastest-using-the-test-shell
Then loading localhost:8080.
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.
I think we could work around this by updating the entrypoint files like so:
react-devtools-inline/backend.js
react-devtools-inline/frontend.js
But I don't know why this is necessary or (more importantly) what other places it might cause trouble.
Anyway, in the spirit of testing, I've made this change locally to see if things works otherwise– and it looks like the DevTools UI is not visible in the test shell (so something is still broken) and I see the following two errors in the console:
Here's my local changes when testing this (in case it helps you any):
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 like I can fix the GET failures by modifying the following files:
But now for some reason the test app code loads 3 times in the page (so there's 3 duplicate copies) and DevTools UI is still not visible at all (though it's loading). It looks like the CSS/styles are weird somehow, because the DevTools UI is loading in the background (behind the duplicate copies of the app).
Digging in a little more, I see a lot of
<div>
elements in the root of the page (outside of the<iframe>
the test app is supposed to load into). Deleting them reveals the DevTools UI underneath, and it even mostly works, but there are a lot of "duplicate ID" errors in the console (presumably from the duplicate test apps) so...something wonky is still going on here.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.
Possibly related to the "3 copies of the app are on the page" thing I mentioned above– the console also shows 3 copies of these logs:
Spaces added by me to highlight the fact that– although the content of the logs is the same, the file locations are different. I think this suggests that Webpack is bundling things oddly?
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.
I think we need to downgrade this back to Webpack 4, e.g.
@sebmarkbage says this plug-in doesn’t work with Webpack 5 since it uses internals and plug-in apis and needs to be ported. (And there's currently no automated test coverage to verify this does or doesn't work.)
Edit 1 Apparently we can test this by building and then
yarn start
ing the fixture in/fixtures/flight/
.The built bundle has a peer dependency on Webpack 4 (via the workspaces) and this might cause problems. I'll test this.
Edit 2: @sebmarkbage has also expressed concern that this change would break this demo: https://github.com/reactjs/server-components-demo
Can we rollback the peer dependency change for this package only?
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.
Thanks for revering the change to
packages/react-server-dom-webpack/package.json
peer dependencies.I've tested the flight fixture after your most recent commit:
Loading localhost:3000 shows the following warnings/errors:
The first warning is expected and indicates that the fixture is just a little out of date. The following errors seem bad though.
For comparison, I've tested the same steps on HEAD of main branch, and I see the app load successfully. So it seems like this update certainly breaks the flight fixture – but would presumably not break the downstream packages/dependencies.
cc @sebmarkbage to confirm is this is acceptable for the time being?
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.
The fixture is acceptable but we need to fix the published package. Worst case maybe we can turn this to
private: true
and exclude it from future builds to avoid confusion until it's fixed.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.
Just to be clear, we're commenting on an outdated version of this PR here. This change was reverted in 13f3bd6 and the latest commit state makes no changes to the
packages/react-server-dom-webpack/package.json
package (or its peer dependencies)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.
Sorry for the drive-by.
I wrote a PR a while ago to support both webpack 5 and webpack 4 (https://github.com/facebook/react/pull/20524/files) in the
react-dom-server-webpack
plugin package.If there is interest, I would be happy to pick it back up and get it into a state where it could be merged in? It sounds like we'd want to add automated tests for the plugin before merging the linked PR.