{"id":13647399,"url":"https://github.com/sindresorhus/electron-reloader","last_synced_at":"2025-04-08T12:07:03.401Z","repository":{"id":28103747,"uuid":"116274692","full_name":"sindresorhus/electron-reloader","owner":"sindresorhus","description":"Simple auto-reloading for Electron apps during development","archived":false,"fork":false,"pushed_at":"2023-03-27T03:00:36.000Z","size":29,"stargazers_count":581,"open_issues_count":11,"forks_count":31,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-01T10:17:32.230Z","etag":null,"topics":["electron","electron-module","livereload","nodejs","npm-package"],"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":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2018-01-04T15:15:10.000Z","updated_at":"2025-03-18T02:48:22.000Z","dependencies_parsed_at":"2023-09-24T06:58:46.446Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/electron-reloader","commit_stats":{"total_commits":29,"total_committers":6,"mean_commits":4.833333333333333,"dds":0.1724137931034483,"last_synced_commit":"9ec0176bf2e1dd2cc43588f863086c1cca6cdab4"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-reloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-reloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-reloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Felectron-reloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/electron-reloader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353720,"owners_count":20925328,"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":["electron","electron-module","livereload","nodejs","npm-package"],"created_at":"2024-08-02T01:03:32.400Z","updated_at":"2025-04-08T12:07:03.384Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript","Library","Tools","三、开发者必备工具"],"sub_categories":["Dev Tools","For Electron","2. 开发调试辅助"],"readme":"# electron-reloader\n\n\u003e Simple auto-reloading for Electron apps during development\n\nIt *just works*. When files used in the main process are changed, the app is restarted, and when files used in the browser window are changed, the page is reloaded.\n\nNote that it will not work correctly if you transpile the main process JS files of your app, but it doesn't make sense to do that anyway.\n\n## Install\n\n```sh\nnpm install --save-dev electron-reloader\n```\n\n*Requires Electron 5 or later.*\n\n## Usage\n\nThe following must be included in the app entry file, usually named `index.js`:\n\n```js\ntry {\n\trequire('electron-reloader')(module);\n} catch {}\n```\n\nYou have to pass the `module` object so we can read the module graph and figure out which files belong to the main process.\n\nThe `try/catch` is needed so it doesn't throw `Cannot find module 'electron-reloader'` in production.\n\n## API\n\n### reloader(module, options?)\n\n#### module\n\nType: `object`\n\nThe global `module` object.\n\n#### options\n\nType: `object`\n\n##### ignore\n\nType: `Array\u003cstring | RegExp\u003e`\n\nIgnore patterns passed to [`chokidar`](https://github.com/paulmillr/chokidar#path-filtering).\n\nBy default, files/directories starting with a `.`, `.map` files, and `node_modules` directories are ignored. This option is additive to those.\n\n##### watchRenderer\n\nType: `boolean`\\\nDefault: `true`\n\nWatch files used in the renderer process and reload the window when they change.\n\nSetting this to `false` can be useful if you use a different reload strategy in the rendererer process, like [`HMR`](https://webpack.js.org/concepts/hot-module-replacement/).\n\n##### debug\n\nType: `boolean`\\\nDefault: `false`\n\nPrints watched paths and when files change.\n\nCan be useful to make sure you set it up correctly.\n\n## Tip\n\n### Using it with Webpack watch mode\n\nJust add the source directory to the `ignore` option. The dist directory is already watched, so when a source file changes, webpack will build it and output it to the dist directory, which this module will detect.\n\n## Related\n\n- [electron-util](https://github.com/sindresorhus/electron-util) - Useful utilities for developing Electron apps and modules\n- [electron-debug](https://github.com/sindresorhus/electron-debug) - Adds useful debug features to your Electron app\n- [electron-context-menu](https://github.com/sindresorhus/electron-context-menu) - Context menu for your Electron app\n- [electron-dl](https://github.com/sindresorhus/electron-dl) - Simplified file downloads for your Electron app\n- [electron-unhandled](https://github.com/sindresorhus/electron-unhandled) - Catch unhandled errors and promise rejections in your Electron app\n- [electron-serve](https://github.com/sindresorhus/electron-serve) - Static file serving for Electron apps\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Felectron-reloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Felectron-reloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Felectron-reloader/lists"}