{"id":13602563,"url":"https://github.com/sindresorhus/electron-is-dev","last_synced_at":"2025-05-15T05:07:10.873Z","repository":{"id":40614231,"uuid":"55792629","full_name":"sindresorhus/electron-is-dev","owner":"sindresorhus","description":"Check if Electron is running in development","archived":false,"fork":false,"pushed_at":"2024-01-13T14:58:38.000Z","size":22,"stargazers_count":433,"open_issues_count":1,"forks_count":34,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-12T03:25:05.568Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2016-04-08T16:13:13.000Z","updated_at":"2025-05-05T19:25:17.000Z","dependencies_parsed_at":"2023-09-27T09:48:48.166Z","dependency_job_id":"75e167c8-94e2-436f-839f-34ae5e7f632c","html_url":"https://github.com/sindresorhus/electron-is-dev","commit_stats":{"total_commits":34,"total_committers":7,"mean_commits":4.857142857142857,"dds":0.2941176470588235,"last_synced_commit":"f944066b8c8515c1066e8c970451e90177de9ea4"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-is-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-is-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-is-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-is-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/electron-is-dev/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276447,"owners_count":22043867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T18:01:28.893Z","updated_at":"2025-05-15T05:07:10.742Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# electron-is-dev\n\n\u003e Check if [Electron](https://electronjs.org) is running in development\n\nUseful for enabling debug features only during development.\n\nThis package must be used from the Electron main process.\n\n## Install\n\n```sh\nnpm install electron-is-dev\n```\n\n*Requires Electron 28 or later.*\n\n## Usage\n\n```js\nimport isDev from 'electron-is-dev';\n\nif (isDev) {\n\tconsole.log('Running in development');\n} else {\n\tconsole.log('Running in production');\n}\n```\n\nYou can force development mode by setting the `ELECTRON_IS_DEV` environment variable to `1`.\n\n## FAQ\n\n### How is this different than [`app.isPackaged`](https://www.electronjs.org/docs/api/app#appispackaged-readonly)?\n\nThis package existed long before that property. The benefit of this package is that you can override the value using an environment variable.\n\n### How do I use this in the renderer process?\n\nYou can use [`contextBridge`](https://www.electronjs.org/docs/latest/api/context-bridge) in the [preload script](https://www.electronjs.org/docs/latest/tutorial/tutorial-preload) to manually expose the variable:\n\n```js\nimport {contextBridge} from 'electron';\nimport isDev from 'electron-is-dev';\n\ncontextBridge.exposeInMainWorld('isDev', isDev);\n```\n\nYou can then access it in `globalThis` from the renderer process:\n\n```js\nconsole.log(globalThis.isDev);\n```\n\n## Related\n\n- [electron-util](https://github.com/sindresorhus/electron-util) - Useful utilities for developing Electron apps\n- [electron-debug](https://github.com/sindresorhus/electron-debug) - Adds useful debug features to your Electron app\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript","Library","Tools","三、开发者必备工具"],"sub_categories":["Check/Detect","For Electron","2. 开发调试辅助"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Felectron-is-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Felectron-is-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Felectron-is-dev/lists"}