ssbc / chloride

MIT License
90 stars 17 forks source link

chloride launches electron every time it's required #2

Closed uiur closed 4 years ago

uiur commented 8 years ago

chloride launches electron if electron is installed globally. (The module name of electron-prebuilt is renamed to electron. https://github.com/electron-userland/electron-prebuilt#installation )

npm i -g electron

This is because isElectron() requires electron to detect it.

function isElectron () {
  try {
    require('electron')
    return true
  } catch (_) { return false }
}

https://github.com/dominictarr/chloride/blob/ca6978b4a0eaa07e490f0df0993e22dd4391fed8/index.js#L7

A possible solution is to see process.versions.electron etc. instead. https://github.com/cheton/is-electron/blob/master/index.js

dominictarr commented 8 years ago

great! thanks I've used this fix in chloride@2.2.3