react: [DevTools Bug]: Electron support broken in 4.27
Website or app
Repro steps
React devtools 4.27 no longer works in Electron[1] because chrome.scripting isn’t implemented, which it started using due to the manifest v3 upgrade: https://github.com/facebook/react/pull/25145
When opening React devtools 4.27 in any Electron project (installed with `electron-devtools-installer for example) you’ll see that the devtools panel is shown but no React components are ever found. Earlier versions worked well with Electron
[1] https://github.com/electron/electron/issues/36545 and https://github.com/MarshallOfSound/electron-devtools-installer/issues/232
How often does this bug happen?
Every time
DevTools package (automated)
No response
DevTools version (automated)
No response
Error message (automated)
No response
Error call stack (automated)
No response
Error component stack (automated)
No response
GitHub query string (automated)
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 22
- Comments: 27 (4 by maintainers)
Commits related to this issue
- Remove react devtools extension This extension is currently broken. https://github.com/facebook/react/issues/25843 — committed to MHeasell/rwe by MHeasell a year ago
- Remove react devtools extension This extension is currently broken. https://github.com/facebook/react/issues/25843 — committed to MHeasell/rwe by MHeasell a year ago
- react-devtools is currently broken against electron - https://github.com/facebook/react/issues/25843 — committed to keyboardio/Chrysalis by obra a year ago
- react-devtools is currently broken against electron - https://github.com/facebook/react/issues/25843 — committed to keyboardio/Chrysalis by obra a year ago
- react-devtools is currently broken against electron - https://github.com/facebook/react/issues/25843 — committed to keyboardio/Chrysalis by obra a year ago
- react-devtools is currently broken against electron - https://github.com/facebook/react/issues/25843 — committed to obra/Chrysalis-test by obra a year ago
- react-devtools is currently broken against electron - https://github.com/facebook/react/issues/25843 — committed to obra/Chrysalis-test by obra a year ago
- react-devtools is currently broken against electron - https://github.com/facebook/react/issues/25843 — committed to obra/Chrysalis-test by obra a year ago
- react-devtools is currently broken against electron - https://github.com/facebook/react/issues/25843 — committed to keyboardio/Chrysalis by obra a year ago
- feat: Install react devtools in dev mode Install React Devtools extension when running in dev mode. If the path to extension (unpackaged extension) is not provided via env variable, the extension wil... — committed to Melvin-Abraham/Google-Assistant-Unofficial-Desktop-Client by Melvin-Abraham a year ago
- added custom build of React Dev Tools 4.27.1, with manifest V2, as downloaded from this issue: https://github.com/facebook/react/issues/25843#issuecomment-1406766561 — committed to saleae/electron-devtools-vendor by Marcus10110 5 months ago
tldr; This should be considered an Electron issue. For now, please follow the instructions at the end of this comment.
Hi everyone,
After some digging into the issue, I realized that it’s not possible to create a version that works on both the latest Chrome & Electron, because:
chrome.scriptingto work, which is not available in ElectronThe only possible solution here is to revert the Manifest V3 upgrade. IMO that would be the wrong move. Chrome has announced that it will drop support for Manifest V2 by Jan 2023 (see https://developer.chrome.com/blog/mv2-transition/). Although they have decided to push back the hard deadline, it’s unlikely that it will be pushed back forever. It’s especially ironic that Electron also warns you “Manifest version 2 is deprecated and support will be removed in 2023” when you load an extension, while they don’t have the API of Manifest V3.
So, in my opinion, Electron should add support for
chrome.scriptingas soon as possible. Before that, here is what I recommend:Workaround
loadExtension.Using Wayback Machine, edited with the original instructions from author:
1. Download React-devtools 4.25
[Polypane] have prepared a zip file with react-devtools 4.25 here: fmkadmapgofadopljbjfkapdkoienihi.zip
2. Open [your app] extensions folder
Open the following folder in your explorer/finder:
%APPDATA%/[your app]/extensions/~/Library/Application Support/[your app]/extensions/~/.config/[your app]/extensions/3. Add or replace the current version with the version downloaded in step 1
If you have installed react-devtools:
fmkadmapgofadopljbjfkapdkoienihiand open itIf you do not have react-devtools installed:
fmkadmapgofadopljbjfkapdkoienihiand open it4. Restart [your app]
After restarting [your app], react-devtools should work again. [Your app] will not automatically download new versions so unless you manually refresh, they should continue to work.
That version seems to be having issues with electron 24.
Also that repo redirects CRX requests to the developers domain, instead of downloading directly from the chrome webstore. (see here https://github.com/xupea/electron-devtools-installer/blob/master/src/downloadChromeExtension.ts#L24)- I now realize this is required, because google doesn’t let you download historical chrome versions, unfortunatelyI published https://www.npmjs.com/package/electron-extension-installer to fix that (source code here)
I wrote up some quick downgrade instructions for Electron apps (replace “Polypane” with your app name): https://polypane.app/docs/downgrading-react-devtools/
Ah I see. I’ll try implement a fallback logic and release a fix.
6127570289
On Mon, Feb 19, 2024, 1:57 AM Bartel Eerdekens @.***> wrote:
Also my apologies to people who are impacted by this: I wanted to work on this earlier, but we are extremely understaffed at this moment, and I got pretty swamped in the past a few weeks. I should be able to work on this no later than next week.
Thanks @Kilian ; I turned your fix into a script, tested on Windows in Git Bash
@eltaurito seems it’s still using v3 of react devtool, and
chrome.scripting.registerContentScriptsis not supported by electron, can you try to delete the Electron extension folder in your %APPDATA% , thennpm startHi guys!
Is this problem still there?
I tried to get the latest version of Electron React Boilerplate, and i still have problems with the DevTools extension.
Do we have any news?
Thanks!
Davide
@filipefborba sorry, I think I put the “good first issue” label there by mistake. It’s a bit to complex to set things up if you are new to this project.
Should be fixed with Electron v27.0.0+ (and also v25.9.0 and v26.3.0) with this pull request.
Any news regarding this matter yet?
electron version is 22,node version is 16.14.0
@Kilian @eltaurito @madenney try this repo: https://github.com/xupea/electron-devtools-installer, which may ease your pain