Skip to content

Commit

Permalink
fix: fix Electron not starting in development from the CLI (#16116)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored and BinaryMuse committed Dec 18, 2018
1 parent 1c7a472 commit 6c998aa
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions npm/index.js
Expand Up @@ -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()

0 comments on commit 6c998aa

Please sign in to comment.