Preflight Checklist
Electron Version
40.6.1
What operating system(s) are you using?
Windows
Operating System Version
Windows 11 23H2 (Build 22631.6783)
What arch are you using?
x64
Last Known Working Electron version
39.8.0
Does the issue also appear in Chromium / Google Chrome?
I don't know how to test
Expected Behavior
After upgrading from Electron 39 to Electron 40, DevTools formatter workers fail to load when DevTools are displayed in a separate BrowserWindow using setDevToolsWebContents().
The DevTools UI loads and is partially functional, but features that depend on the formatter worker (like code formatting) do not work.
The formatter worker fails to load with the following error:
Failed to load worker for devtools://devtools/bundled/entrypoints/formatter_worker/formatter_worker-entrypoint.js
Uncaught TypeError: Failed to fetch dynamically imported module: devtools://devtools/bundled/core/platform/node/node.js
Steps to reproduce:
- Create a BrowserWindow with a webview or any web content
- Create a second BrowserWindow to host the DevTools and use
webContents.setDevToolsWebContents(devToolsWindow.webContents) to redirect DevTools to the dedicated window
- Call
webContents.openDevTools({ mode: 'detach' })
- In DevTools click Sources, then on jquery.min.js
Actual Behavior
With electron >= 40, the file will be empty, pressing CTRL+I reveals some errors loading the formatter worker.
With electron <=39, the file will be shown pretty-printed.
I cannot rule out that there may be an error on our end when attaching the devtools into the extra window. However, we have already tried various solutions and are not making any progress here. We also attempted to disable all mechanisms in the webPreferences that could prevent loading (e.g., webSecurity: false, sandbox: false, etc.), but without success. What changed between Electron 39 and Electron 40?
Testcase Gist URL
https://gist.github.com/06181efdd5ffb57bdeaf8614843ea600
Additional Information

Preflight Checklist
Electron Version
40.6.1
What operating system(s) are you using?
Windows
Operating System Version
Windows 11 23H2 (Build 22631.6783)
What arch are you using?
x64
Last Known Working Electron version
39.8.0
Does the issue also appear in Chromium / Google Chrome?
I don't know how to test
Expected Behavior
After upgrading from Electron 39 to Electron 40, DevTools formatter workers fail to load when DevTools are displayed in a separate BrowserWindow using
setDevToolsWebContents().The DevTools UI loads and is partially functional, but features that depend on the formatter worker (like code formatting) do not work.
The formatter worker fails to load with the following error:
Steps to reproduce:
webContents.setDevToolsWebContents(devToolsWindow.webContents)to redirect DevTools to the dedicated windowwebContents.openDevTools({ mode: 'detach' })Actual Behavior
With electron >= 40, the file will be empty, pressing CTRL+I reveals some errors loading the formatter worker.
With electron <=39, the file will be shown pretty-printed.
I cannot rule out that there may be an error on our end when attaching the devtools into the extra window. However, we have already tried various solutions and are not making any progress here. We also attempted to disable all mechanisms in the webPreferences that could prevent loading (e.g., webSecurity: false, sandbox: false, etc.), but without success. What changed between Electron 39 and Electron 40?
Testcase Gist URL
https://gist.github.com/06181efdd5ffb57bdeaf8614843ea600
Additional Information