diff --git a/.changeset/unlucky-scissors-ring.md b/.changeset/unlucky-scissors-ring.md new file mode 100644 index 0000000..e7c00ae --- /dev/null +++ b/.changeset/unlucky-scissors-ring.md @@ -0,0 +1,5 @@ +--- +"hot-hook": patch +--- + +[Vite has a bug](https://github.com/vitejs/vite/issues/13267) that causes a `vite.config.js.timestamp-*` file to be created and persisted under certain conditions. When Hot-Hook is used with Vite, this bug can sometimes cause the server to restart indefinitely. Consequently, this commit adds these files by default to Hot-Hook's `ignore` config. diff --git a/packages/hot_hook/src/hot.ts b/packages/hot_hook/src/hot.ts index 0a36e41..65850af 100644 --- a/packages/hot_hook/src/hot.ts +++ b/packages/hot_hook/src/hot.ts @@ -45,7 +45,16 @@ class Hot { async init(options: InitOptions) { this.#options = Object.assign( { - ignore: ['**/node_modules/**'], + ignore: [ + '**/node_modules/**', + /** + * Vite has a bug where it create multiple files with a + * timestamp. This cause hot-hook to restart in loop. + * See https://github.com/vitejs/vite/issues/13267 + */ + '**/vite.config.js.timestamp*', + '**/vite.config.ts.timestamp*', + ], restart: ['.env'], }, options