Skip to content

Commit

Permalink
fix: drop toggle hmr shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Dec 7, 2022
1 parent be6785a commit 6ae1d2d
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions packages/vite/src/node/shortcuts.ts
@@ -1,7 +1,6 @@
import colors from 'picocolors'
import type { ViteDevServer } from './server'
import { openBrowser } from './server/openBrowser'
import type { HmrOptions } from './server/hmr'
import { isDefined } from './utils'

export type BindShortcutsOptions = {
Expand Down Expand Up @@ -80,8 +79,6 @@ export function bindShortcuts(
})
}

let initialHmrOptions: HmrOptions | boolean

const BASE_SHORTCUTS: CLIShortcut[] = [
{
key: 'r',
Expand All @@ -104,26 +101,6 @@ const BASE_SHORTCUTS: CLIShortcut[] = [
openBrowser(url, true, server.config.logger)
},
},
{
key: 'm',
description: 'toggle hmr on/off',
action({ config }: ViteDevServer): void {
initialHmrOptions ??= config.server.hmr ?? true
/**
* Mutating the server config works because Vite reads from
* it on every file change, instead of caching its value.
*/
config.server.hmr =
config.server.hmr === false
? initialHmrOptions === false
? true
: initialHmrOptions
: false
config.logger.info(
colors.cyan(`hmr ${config.server.hmr ? `enabled` : `disabled`}`),
)
},
},
{
key: 'q',
description: 'quit',
Expand Down

0 comments on commit 6ae1d2d

Please sign in to comment.