installExtension(REACT_DEVELOPER_TOOLS) .then((name) => console.log(`Extension Added!: ${name}`)) .catch((err) => { console.log('An Error Occurred: ', err) console.log('But PLEASE DO NOT WORRY!') console.log('It`s FINE! It`s NOT IMPORTANT at all!') });
function createWindow() { const { width, height } = electron.screen.getPrimaryDisplay().workAreaSize; // Create the browser window. mainWindow = new BrowserWindow({ autoHideMenuBar: true }); mainWindow.maximize(); // and load the index.html of the app. mainWindow.loadURL(url.format({ pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true })); // Open the DevTools. installExtension(REACT_DEVELOPER_TOOLS) .then((name) => { console.log(`Added Extension: ${name}`); mainWindow.webContents.openDevTools(); }) .catch((err) => console.log('An error occurred: ', err)); // Emitted when the window is closed. mainWindow.on('closed', function () { // Dereference the window object, usually you would store windows // in an array if your app supports multi windows, this is the time // when you should delete the corresponding element. mainWindow = null; }); }
installExtension(REACT_DEVELOPER_TOOLS) .then((name) => console.log(`Added Extension: ${name}`)) .catch((err) => console.log('An error occurred: ', err));
const { default: installExtension, REACT_DEVELOPER_TOOLS } = require('electron-devtools-installer') installExtension(REACT_DEVELOPER_TOOLS) .catch(err => console.log('Error loading React DevTools: ', err)) mainWindow.webContents.openDevTools()