Skip to content
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

[DevTools] webpack 5 + ignore listing backend to avoid confusion #26506

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mondaychen
Copy link
Contributor

@mondaychen mondaychen commented Mar 29, 2023

Summary

  • Upgrade webpack (and related packages) in react-devtools-extension to latest version (v5)
  • Add source map for react_devtools_backend.js in production build so that we can use it to do ignore listing

How did you test this change?

Tested it on a react app on codesandbox that run console.error when user clicks the button https://3owqsn.csb.app/

Before this change, the stack trace includes "react_devtools_backend.js", which can mislead developers to believe this error is triggered by React DevTools instead of their own code
Untitled

After this change, it is hidden in the stack by default
image

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 29, 2023
@react-sizebot
Copy link

react-sizebot commented Mar 29, 2023

Comparing: 1f5cdf8...e4d485f

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 162.97 kB 162.97 kB = 51.50 kB 51.50 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 164.71 kB 164.71 kB = 52.03 kB 52.03 kB
facebook-www/ReactDOM-prod.classic.js = 556.92 kB 556.92 kB = 98.54 kB 98.54 kB
facebook-www/ReactDOM-prod.modern.js = 540.64 kB 540.64 kB = 96.12 kB 96.12 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against e4d485f

@mondaychen mondaychen marked this pull request as draft March 29, 2023 22:44
@mondaychen
Copy link
Contributor Author

I need to upgrade webpack for all devtools packages, which turns out to be more trouble than I anticipated. As of now I'm blocked because hook name parsing feature is broken for unknown reason (some unexpected babel files compiled into it).

hoxyq added a commit that referenced this pull request Jun 14, 2023
## Summary
- Updated `webpack` (and all related packages) to v5 in
`react-devtools-*` packages.
- I haven't touched any `TODO (Webpack 5)`. Tried to poke it, but each
my attempt failed and parsing hook names feature stopped working. I will
work on this in a separate PR.
- This work is one of prerequisites for updating Firefox extension to
manifests v3

related PRs:
#22267
#26506

## How did you test this change?
Tested on all surfaces, explicitly checked that parsing hook names
feature still works.
hoxyq added a commit that referenced this pull request Jun 21, 2023
…6951)

## Summary
This was originally implemented by Mengdi @mondaychen in
#26506.

Because we patch console methods (to append components stack and some
other features), errors in console will include
`react_devtools_backend-....js` in its stack traces. Example:
<img width="763" alt="Screenshot 2023-06-15 at 13 31 49"
src="https://github.com/facebook/react/assets/28902667/fa9c3d26-b6c5-4965-af71-62d100cd806d">

Using https://github.com/mondaychen/devtools-ignore-webpack-plugin to
support [x_google_ignoreList source maps
extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).

@mondaychen created a react app, which throws an error via
`console.error`, when user click on the button -
https://3owqsn.csb.app/.

Stack trace with these changes: 
<img width="759" alt="Screenshot 2023-06-14 at 14 26 38"
src="https://github.com/facebook/react/assets/28902667/b118b168-3200-4a47-9718-39fc455ea993">
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
## Summary
- Updated `webpack` (and all related packages) to v5 in
`react-devtools-*` packages.
- I haven't touched any `TODO (Webpack 5)`. Tried to poke it, but each
my attempt failed and parsing hook names feature stopped working. I will
work on this in a separate PR.
- This work is one of prerequisites for updating Firefox extension to
manifests v3

related PRs:
facebook#22267
facebook#26506

## How did you test this change?
Tested on all surfaces, explicitly checked that parsing hook names
feature still works.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
…cebook#26951)

## Summary
This was originally implemented by Mengdi @mondaychen in
facebook#26506.

Because we patch console methods (to append components stack and some
other features), errors in console will include
`react_devtools_backend-....js` in its stack traces. Example:
<img width="763" alt="Screenshot 2023-06-15 at 13 31 49"
src="https://github.com/facebook/react/assets/28902667/fa9c3d26-b6c5-4965-af71-62d100cd806d">

Using https://github.com/mondaychen/devtools-ignore-webpack-plugin to
support [x_google_ignoreList source maps
extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).

@mondaychen created a react app, which throws an error via
`console.error`, when user click on the button -
https://3owqsn.csb.app/.

Stack trace with these changes: 
<img width="759" alt="Screenshot 2023-06-14 at 14 26 38"
src="https://github.com/facebook/react/assets/28902667/b118b168-3200-4a47-9718-39fc455ea993">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants