Npm script, Electron and environment variables

In short

In app:

var isDev = process.env.TODO_DEV ? process.env.TODO_DEV.trim() == "true";  

In package.json let's say we have:

"start": "electron . --enable-logging --remote-debugging-port=9222"

With cross-env package:

"dev": cross-env TODO_DEV=true npm run start

or without dependencies:

"dev:mac": TODO_DEV=true npm run start,
"dev:win": SET TODO_DEV=true && npm run start

Longer version

If you're working with npm scripts (or

Read More