DevTools Extension
The easiest way to load a DevTools extension is to use third-party tooling to automate the process for you. electron-devtools-installer is a popular NPM package that does just that.
If you don’t want to use the tooling approach, you can also do all of the necessary operations by hand. To load an extension in Electron, you need to download it via Chrome, locate its filesystem path, and then load it into your by calling the [] API.
- Install the extension in Google Chrome.
- Navigate to
chrome://extensions
, and find its extension ID, which is a hash string likefmkadmapgofadopljbjfkapdkoienihi
. - Find out the filesystem location used by Chrome for storing extensions:
- on Linux it could be:
~/.config/google-chrome/Default/Extensions/
~/.config/google-chrome-beta/Default/Extensions/
~/.config/chromium/Default/Extensions/
- on macOS it is
~/Library/Application Support/Google/Chrome/Default/Extensions
.
- on Linux it could be:
Pass the location of the extension to the
ses.loadExtension
API. For React Developer Toolsv4.9.0
, it looks something like:
Notes:
loadExtension
returns a Promise with an , which contains metadata about the extension that was loaded. This promise needs to resolve (e.g. with an expression) before loading a page. Otherwise, the extension won’t be guaranteed to load.loadExtension
must be called on every boot of your app if you want the extension to be loaded.
Electron only supports
a limited set of APIs,
so extensions using unsupported chrome.*
APIs under the hood may not work.
The following Devtools extensions have been tested to work in Electron:
What should I do if a DevTools extension is not working?
If the extension works on Chrome but not on Electron, file a bug in Electron’s issue tracker and describe which part of the extension is not working as expected.