From 6c998aa4f2ee7d998a0fbd8613b9d62ccf6d3492 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 18 Dec 2018 16:26:22 +1300 Subject: [PATCH] fix: fix Electron not starting in development from the CLI (#16116) --- npm/index.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/npm/index.js b/npm/index.js index 5c88e9a649588..b33c9b493f3bb 100644 --- a/npm/index.js +++ b/npm/index.js @@ -15,20 +15,4 @@ function getElectronPath () { } } -// A list of the main modules the people will attempt to use from the Electron API, this is not a complete list but should cover most -// use cases. -var electronModuleNames = ['app', 'autoUpdater', 'BrowserWindow', 'ipcMain', 'Menu', 'net', 'Notification', 'systemPreferences', 'Tray'] -var electronPath = new String(getElectronPath()) - -electronModuleNames.forEach(function warnOnElectronAPIAccess (apiKey) { - Object.defineProperty(electronPath, apiKey, { - enumerable: false, - configurable: false, - get: function getElectronAPI () { - console.warn('WARNING: You are attempting to access an Electron API from a node environment.\n\n' + - 'You need to use the "electron" command to run your app. E.g. "npx electron ./myapp.js"') - } - }) -}) - -module.exports = electronPath +module.exports = getElectronPath()