mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2025-01-09 14:12:05 -05:00
only import electron-devtools-installer in dev mode
This commit is contained in:
parent
eff882c928
commit
4767897f4b
1 changed files with 7 additions and 6 deletions
|
@ -2,8 +2,6 @@ import {app, BrowserWindow} from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {format as formatUrl} from 'url';
|
import {format as formatUrl} from 'url';
|
||||||
|
|
||||||
import installExtension, {REACT_DEVELOPER_TOOLS} from 'electron-devtools-installer';
|
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
// global reference to mainWindow (necessary to prevent window from being garbage collected)
|
// global reference to mainWindow (necessary to prevent window from being garbage collected)
|
||||||
|
@ -18,10 +16,13 @@ const createMainWindow = () => {
|
||||||
|
|
||||||
if (isDevelopment) {
|
if (isDevelopment) {
|
||||||
window.webContents.openDevTools();
|
window.webContents.openDevTools();
|
||||||
installExtension(REACT_DEVELOPER_TOOLS);
|
import('electron-devtools-installer').then(importedModule => {
|
||||||
// TODO: add logging package and bring back the lines below
|
const {default: installExtension, REACT_DEVELOPER_TOOLS} = importedModule;
|
||||||
// .then(name => console.log(`Added Extension: ${name}`))
|
installExtension(REACT_DEVELOPER_TOOLS);
|
||||||
// .catch(err => console.log('An error occurred: ', err));
|
// TODO: add logging package and bring back the lines below
|
||||||
|
// .then(name => console.log(`Added Extension: ${name}`))
|
||||||
|
// .catch(err => console.log('An error occurred: ', err));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDevelopment) {
|
if (isDevelopment) {
|
||||||
|
|
Loading…
Reference in a new issue