{"id":13880903,"url":"https://github.com/ElMassimo/vite-plugin-stimulus-hmr","last_synced_at":"2025-07-16T17:31:18.656Z","repository":{"id":41351042,"uuid":"339136540","full_name":"ElMassimo/vite-plugin-stimulus-hmr","owner":"ElMassimo","description":"⚡️ HMR for Stimulus controllers in Vite.js","archived":false,"fork":false,"pushed_at":"2023-11-16T20:27:21.000Z","size":319,"stargazers_count":58,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-15T10:23:04.089Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/ElMassimo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2021-02-15T16:25:18.000Z","updated_at":"2025-06-19T08:16:22.000Z","dependencies_parsed_at":"2024-02-24T23:32:33.805Z","dependency_job_id":"b04df2bb-ab8d-47e0-b6ba-0427ffd4ba9a","html_url":"https://github.com/ElMassimo/vite-plugin-stimulus-hmr","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"3132a4c43d5901986a71d81db421fa266aea2e4a"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ElMassimo/vite-plugin-stimulus-hmr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-stimulus-hmr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-stimulus-hmr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-stimulus-hmr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-stimulus-hmr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElMassimo","download_url":"https://codeload.github.com/ElMassimo/vite-plugin-stimulus-hmr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElMassimo%2Fvite-plugin-stimulus-hmr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265527547,"owners_count":23782480,"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-06T08:03:37.589Z","updated_at":"2025-07-16T17:31:18.336Z","avatar_url":"https://github.com/ElMassimo.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch2 align='center'\u003e\u003csamp\u003evite-plugin-stimulus-hmr\u003c/samp\u003e\u003c/h2\u003e\n\n\u003cp align='center'\u003eHMR for Stimulus controllers in Vite.js\u003c/p\u003e\n\n\u003cp align='center'\u003e\n  \u003ca href='https://www.npmjs.com/package/vite-plugin-stimulus-hmr'\u003e\n    \u003cimg src='https://img.shields.io/npm/v/vite-plugin-stimulus-hmr?color=222\u0026style=flat-square'\u003e\n  \u003c/a\u003e\n  \u003ca href='https://github.com/ElMassimo/vite-plugin-stimulus-hmr/blob/main/LICENSE.txt'\u003e\n    \u003cimg src='https://img.shields.io/badge/license-MIT-blue.svg'\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n[vite_rails]: https://github.com/ElMassimo/vite_ruby/tree/main/vite_rails\n[vite_ruby]: https://github.com/ElMassimo/vite_ruby/tree/main/vite_ruby\n[glob]: https://vitejs.dev/guide/features.html#glob-import\n[jumpstart]: https://github.com/ElMassimo/jumpstart-vite\n[stimulus handbook]: https://stimulus.hotwire.dev/handbook/installing\n[stimulus]: https://github.com/hotwired/stimulus\n[vite_rails]: https://vite-rails.netlify.app\n[vite]: http://vitejs.dev/\n[idempotent]: https://turbo.hotwire.dev/handbook/building#making-transformations-idempotent\n[HMR]: https://vitejs.dev/guide/features.html#hot-module-replacement\n\nThis plugin for [Vite.js][vite] provides [HMR] for [Stimulus] controllers,\nallowing you to tweak your code without having to wait for the page to refresh.\n\n## Demo 🎥\n\nChanges to Stimulus controllers don't require a full page refresh.\n\n\u003ca href=\"https://user-images.githubusercontent.com/1158253/107971586-6deb2480-6f91-11eb-8919-100ca36f3683.mp4\" rel=\"noreferrer\" target=\"_blank\"\u003e\n  \u003cimg width=\"836\" alt=\"Screen Shot 2021-02-15 at 13 27 22\" src=\"https://user-images.githubusercontent.com/1158253/107971695-8e1ae380-6f91-11eb-9ef7-9fed47d4d3be.png\"\u003e\n\u003c/a\u003e\n\nThe modified controller will be re-registered, so existing instances of it will `disconnect`, and new instances will be created and `connect`ed with the updated code.\n\n## Installation 💿\n\nHMR comes installed by default in [Jumpstart Rails with Vite.js][jumpstart],\na starter template that you can use to start your next Rails app.\n\nIf installing manually:\n\n```bash\nnpx ni vite-plugin-stimulus-hmr\n```\n\n## Usage 🚀\n\nAdd it to your plugins in `vite.config.js`\n\n```ts\n// vite.config.js\nimport StimulusHMR from 'vite-plugin-stimulus-hmr'\n\nexport default {\n  plugins: [\n    StimulusHMR(),\n  ],\n}\n```\n\nYou should now enjoy HMR for your Stimulus controllers! 🚀\n\n## How does it work? 🤔\n\nIn order to simplify integration, the plugin will try to automatically detect when you define your Stimulus app, as in:\n\n```js\nconst app = Application.start()\n```\n\nIt will then detect any controller files using the Stimulus conventions, and inject an HMR `accept` call that re-registers the updated controller.\n\nJust as when you use Turbolinks, it's important that your controllers are [idempotent].\n\n## License\n\nThis library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElMassimo%2Fvite-plugin-stimulus-hmr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FElMassimo%2Fvite-plugin-stimulus-hmr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElMassimo%2Fvite-plugin-stimulus-hmr/lists"}