2015-09-01 02:17:41 +00:00
|
|
|
# DevTools Extension
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
Electron supports the [Chrome DevTools Extension][devtools-extension], which can
|
|
|
|
be used to extend the ability of devtools for debugging popular web frameworks.
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
## How to load a DevTools Extension
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-07-14 21:12:06 +00:00
|
|
|
This document outlines the process for manually loading an extension.
|
|
|
|
You may also try
|
|
|
|
[electron-devtools-installer](https://github.com/GPMDP/electron-devtools-installer),
|
2016-07-14 21:16:02 +00:00
|
|
|
a third-party tool that downloads extensions directly from the Chrome WebStore.
|
2016-07-14 21:12:06 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
To load an extension in Electron, you need to download it in Chrome browser,
|
|
|
|
locate its filesystem path, and then load it by calling the
|
|
|
|
`BrowserWindow.addDevToolsExtension(extension)` API.
|
2015-11-03 15:11:29 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
Using the [React Developer Tools][react-devtools] as example:
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
1. Install it in Chrome browser.
|
|
|
|
1. Navigate to `chrome://extensions`, and find its extension ID, which is a hash
|
|
|
|
string like `fmkadmapgofadopljbjfkapdkoienihi`.
|
|
|
|
1. Find out filesystem location used by Chrome for storing extensions:
|
|
|
|
* on Windows it is `%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions`;
|
2016-06-03 01:12:58 +00:00
|
|
|
* on Linux it could be:
|
|
|
|
* `~/.config/google-chrome/Default/Extensions/`
|
|
|
|
* `~/.config/google-chrome-beta/Default/Extensions/`
|
|
|
|
* `~/.config/google-chrome-canary/Default/Extensions/`
|
|
|
|
* `~/.config/chromium/Default/Extensions/`
|
2016-06-18 13:26:26 +00:00
|
|
|
* on macOS it is `~/Library/Application Support/Google/Chrome/Default/Extensions`.
|
2016-05-29 06:19:41 +00:00
|
|
|
1. Pass the location of the extension to `BrowserWindow.addDevToolsExtension`
|
|
|
|
API, for the React Developer Tools, it is something like:
|
2019-01-15 08:48:21 +00:00
|
|
|
```javascript
|
|
|
|
const path = require('path')
|
|
|
|
const os = require('os')
|
|
|
|
|
|
|
|
BrowserWindow.addDevToolsExtension(
|
|
|
|
path.join(os.homedir(), '/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/0.15.0_0')
|
|
|
|
)
|
|
|
|
```
|
2016-07-27 20:01:01 +00:00
|
|
|
|
|
|
|
**Note:** The `BrowserWindow.addDevToolsExtension` API cannot be called before the
|
|
|
|
ready event of the app module is emitted.
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2019-06-15 11:38:55 +00:00
|
|
|
The extension will be remembered so you only need to call this API once per
|
|
|
|
extension. If you try to add an extension that has already been loaded, this method
|
|
|
|
will not return and instead log a warning to the console.
|
|
|
|
|
|
|
|
### How to remove a DevTools Extension
|
|
|
|
|
|
|
|
You can pass the name of the extension to the `BrowserWindow.removeDevToolsExtension`
|
|
|
|
API to remove it. The name of the extension is returned by
|
|
|
|
`BrowserWindow.addDevToolsExtension` and you can get the names of all installed
|
|
|
|
DevTools Extensions using the `BrowserWindow.getDevToolsExtensions` API.
|
2015-10-11 13:18:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
## Supported DevTools Extensions
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
Electron only supports a limited set of `chrome.*` APIs, so some extensions
|
|
|
|
using unsupported `chrome.*` APIs for chrome extension features may not work.
|
|
|
|
Following Devtools Extensions are tested and guaranteed to work in Electron:
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
* [Ember Inspector](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
|
|
|
|
* [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi)
|
|
|
|
* [Backbone Debugger](https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd)
|
|
|
|
* [jQuery Debugger](https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi)
|
|
|
|
* [AngularJS Batarang](https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk)
|
|
|
|
* [Vue.js devtools](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
|
2018-01-12 15:24:48 +00:00
|
|
|
* [Cerebral Debugger](https://cerebraljs.com/docs/introduction/debugger.html)
|
2016-11-13 16:32:31 +00:00
|
|
|
* [Redux DevTools Extension](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd)
|
2017-11-21 19:38:14 +00:00
|
|
|
* [MobX Developer Tools](https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod)
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
### What should I do if a DevTools Extension is not working?
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-06-19 16:24:00 +00:00
|
|
|
First please make sure the extension is still being maintained, some extensions
|
2016-05-29 06:19:41 +00:00
|
|
|
can not even work for recent versions of Chrome browser, and we are not able to
|
|
|
|
do anything for them.
|
2014-08-28 08:33:27 +00:00
|
|
|
|
2016-05-29 06:19:41 +00:00
|
|
|
Then file a bug at Electron's issues list, and describe which part of the
|
|
|
|
extension is not working as expected.
|
2014-08-28 08:33:27 +00:00
|
|
|
|
|
|
|
[devtools-extension]: https://developer.chrome.com/extensions/devtools
|
2016-05-29 06:19:41 +00:00
|
|
|
[react-devtools]: https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
|