fix: recreating keyboardShortcuts interface on file changes. (#1465)
Co-authored-by: Aaron <aaronklinker1@gmail.com>
This commit is contained in:
@@ -110,8 +110,13 @@ async function createServerInternal(): Promise<WxtDevServer> {
|
||||
|
||||
// Listen for file changes and reload different parts of the extension accordingly
|
||||
const reloadOnChange = createFileReloader(server);
|
||||
server.watcher.on('all', reloadOnChange);
|
||||
keyboardShortcuts.start();
|
||||
server.watcher.on('all', async (...args) => {
|
||||
await reloadOnChange(args[0], args[1]);
|
||||
|
||||
// Restart keyboard shortcuts after file is changed - for some reason they stop working.
|
||||
keyboardShortcuts.start();
|
||||
});
|
||||
|
||||
keyboardShortcuts.printHelp({
|
||||
canReopenBrowser:
|
||||
!wxt.config.runnerConfig.config.disabled && !!runner.canOpen?.(),
|
||||
|
||||
@@ -26,9 +26,7 @@ export function createKeyboardShortcuts(
|
||||
|
||||
return {
|
||||
start() {
|
||||
if (rl) return;
|
||||
|
||||
rl = readline.createInterface({
|
||||
rl ??= readline.createInterface({
|
||||
input: process.stdin,
|
||||
terminal: false, // Don't intercept ctrl+C, ctrl+Z, etc
|
||||
});
|
||||
@@ -37,8 +35,7 @@ export function createKeyboardShortcuts(
|
||||
},
|
||||
|
||||
stop() {
|
||||
rl?.close();
|
||||
rl = undefined;
|
||||
rl?.removeListener('line', handleInput);
|
||||
},
|
||||
|
||||
printHelp(flags) {
|
||||
|
||||
Reference in New Issue
Block a user