3.0.1 • Published 3 months ago

electron-is-dev v3.0.1

Weekly downloads
96,219
License
MIT
Repository
github
Last release
3 months ago

electron-is-dev

Check if Electron is running in development

Useful for enabling debug features only during development.

This package must be used from the Electron main process.

Install

npm install electron-is-dev

Requires Electron 28 or later.

Usage

import isDev from 'electron-is-dev';

if (isDev) {
	console.log('Running in development');
} else {
	console.log('Running in production');
}

You can force development mode by setting the ELECTRON_IS_DEV environment variable to 1.

FAQ

How is this different than app.isPackaged?

This package existed long before that property. The benefit of this package is that you can override the value using an environment variable.

How do I use this in the renderer process?

You can use contextBridge in the preload script to manually expose the variable:

import {contextBridge} from 'electron';
import isDev from 'electron-is-dev';

contextBridge.exposeInMainWorld('isDev', isDev);

You can then access it in globalThis from the renderer process:

console.log(globalThis.isDev);

Related

@imohuan/electron-managementclamav-desktopbpmn-studiodesktop-support-toolssoftrd_guisvn-controlefound-appgoxlr-settings-appelectron-quick-start-typescriptkryptokrona-desktop-wallet@sample-vst/desktop-wrapperdeadbolt-appneuron-aioid.periksa.klinikrainbow-boardcj-utils-guilumiastreammethod-clientstocktrackergraasp-insightsrubeushotelizer_satellitedakozanuxo_front_updatecityadpro_playerelectron-react-demoesound-musicproject-stamina-launcherscf-metadata@infinitebrahmanuniverse/nolb-electron-isirecord_appmantis-password-protector@everything-registry/sub-chunk-1565afterstrife-launcheralea-launcherbpmn-studio-alphaedu_proxyelectron_multi_loggerelectron-react-ant-boilerplateelectron-react-typescript-boilerplateelectron-reloaderelectron-reloader-tselectron-typescript-react-tailwind-reduxelectron-unhandledelectron-utilelectron-util-patchedelectron-updater-appimage-fixelectron-updater-debugelectron-updater-grayelektronikerelectron-collectionelectron-debugelectron-context-menuelectron-context-menu-customelectron-argselectron-bootstrapelectron-managerelectron-manager-somiibo-forkelectron-nextelectron-lune-bindingselectron-load-devtoolelectron-isenv-typed-paramsorigin-mint-botors-preodaynpm-all-packagesmidi-bricks-electronmodel-managermetin2-patcher-electronmini-browserniltree-desktoppicknplacepayot-kiosk-webpj-electron-context-menuplayorkooniprobe-desktoppigitnuxonuxosmonoblokk2-clinetmoneysavegbpulin-pc-clienthardware-examplehedy-offlinehbdhasangoogle-workspacegrape-electron-context-menuguild-history-watcherexplorer-desktop-launcherf-curatoreth-alarm-clock-dappfll-launcherhs1-electronhx-wallet-desktopfire-launchergimi_uigfs-electron-updaterjusta-clientinfinity-launcher-dev
3.0.1

3 months ago

3.0.0

3 months ago

2.0.0

3 years ago

1.2.0

4 years ago

1.1.0

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago