Skip to content

Commit

Permalink
fix: Properly close readline instance on close (#1278)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Dec 25, 2024
1 parent 62525d3 commit 0bf7279
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/wxt/src/core/builders/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ export async function createViteBuilder(
},
},
watcher: viteServer.watcher,
on(event, cb) {
viteServer.httpServer?.on(event, cb);
},
};

return server;
Expand Down
2 changes: 2 additions & 0 deletions packages/wxt/src/core/create-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ async function createServerInternal(): Promise<WxtDevServer> {
await runner.openBrowser();
};

builderServer.on?.('close', () => keyboardShortcuts.stop());

return server;
}

Expand Down
1 change: 1 addition & 0 deletions packages/wxt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ export interface WxtBuilderServer {
* Chokidar file watcher instance.
*/
watcher: FSWatcher;
on?(event: string, callback: () => void): void;
}

export interface ServerInfo {
Expand Down

0 comments on commit 0bf7279

Please sign in to comment.