From 4767897f4bd3f7fe080ac0f7b2abc61065525240 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford Date: Wed, 31 Oct 2018 15:57:04 -0700 Subject: [PATCH] only import electron-devtools-installer in dev mode --- src/main/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 493131f..1e0db01 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -2,8 +2,6 @@ import {app, BrowserWindow} from 'electron'; import * as path from 'path'; import {format as formatUrl} from 'url'; -import installExtension, {REACT_DEVELOPER_TOOLS} from 'electron-devtools-installer'; - const isDevelopment = process.env.NODE_ENV !== 'production'; // global reference to mainWindow (necessary to prevent window from being garbage collected) @@ -18,10 +16,13 @@ const createMainWindow = () => { if (isDevelopment) { window.webContents.openDevTools(); - installExtension(REACT_DEVELOPER_TOOLS); - // 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)); + import('electron-devtools-installer').then(importedModule => { + const {default: installExtension, REACT_DEVELOPER_TOOLS} = importedModule; + installExtension(REACT_DEVELOPER_TOOLS); + // 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) {