Skip to content

Commit f24c6de

Browse files
committed
provide react devtools in electron dev builds
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 7c13e2d commit f24c6de

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎electron_app/src/electron-main.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
Copyright 2016 Aviral Dasgupta
33
Copyright 2016 OpenMarket Ltd
4+
Copyright 2017 Michael Telatynski <7t3chguy@gmail.com>
45
56
Licensed under the Apache License, Version 2.0 (the "License");
67
you may not use this file except in compliance with the License.
@@ -216,6 +217,20 @@ electron.ipcMain.on('settings_set', function(ev, key, value) {
216217
});
217218

218219
electron.app.on('ready', () => {
220+
221+
if (argv.devtools) {
222+
try {
223+
const { default: installExtension, REACT_DEVELOPER_TOOLS, REACT_PERF } = require('electron-devtools-installer');
224+
installExtension(REACT_DEVELOPER_TOOLS)
225+
.then((name) => console.log(`Added Extension: ${name}`))
226+
.catch((err) => console.log('An error occurred: ', err));
227+
installExtension(REACT_PERF)
228+
.then((name) => console.log(`Added Extension: ${name}`))
229+
.catch((err) => console.log('An error occurred: ', err));
230+
} catch(e) {console.log(e);}
231+
}
232+
233+
219234
if (vectorConfig.update_base_url) {
220235
console.log(`Starting auto update with base URL: ${vectorConfig.update_base_url}`);
221236
startAutoUpdate(vectorConfig.update_base_url);

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"css-raw-loader": "^0.1.1",
102102
"electron-builder": "^11.2.4",
103103
"electron-builder-squirrel-windows": "^11.2.1",
104+
"electron-devtools-installer": "^2.2.0",
104105
"emojione": "^2.2.7",
105106
"eslint": "^3.14.0",
106107
"eslint-config-google": "^0.7.1",

0 commit comments

Comments
 (0)