
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
electron-is-dev
Advanced tools
The electron-is-dev package is a simple utility for Electron applications to determine if the app is running in development mode. This can be useful for conditionally enabling or disabling certain features or behaviors during development versus production.
Check if in development mode
This feature allows you to check if the Electron app is running in development mode. The code sample demonstrates how to use the electron-is-dev package to log different messages based on the environment.
const isDev = require('electron-is-dev');
if (isDev) {
console.log('Running in development');
} else {
console.log('Running in production');
}
The electron-devtools-installer package is used to install DevTools extensions in Electron applications. While it serves a different primary purpose, it is often used in conjunction with electron-is-dev to conditionally install DevTools extensions only in development mode.
The electron-debug package adds useful debug features to your Electron app, such as keyboard shortcuts for opening DevTools and reloading the window. It can be used alongside electron-is-dev to enable these features only during development.
The electron-reload package provides live reloading for Electron applications. It is similar to electron-is-dev in that it is typically used during development to improve the developer experience by automatically reloading the app when files change.
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.
npm install electron-is-dev
Requires Electron 28 or later.
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
.
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.
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);
FAQs
Check if Electron is running in development
The npm package electron-is-dev receives a total of 152,840 weekly downloads. As such, electron-is-dev popularity was classified as popular.
We found that electron-is-dev demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.