Skip to content

Commit 652ede1

Browse files
committed
chore: remove auto enable
1 parent f6a3c57 commit 652ede1

4 files changed

Lines changed: 5 additions & 17 deletions

File tree

docs/config/shared-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ Learn more in Vite's [SSR guide](/guide/ssr#vite-cli). Related: [`server.middlew
515515

516516
- **Experimental:** [Give Feedback](https://github.com/vitejs/devtools/discussions)
517517
- **Type:** `boolean` | `DevToolsConfig`
518-
- **Default:** `false` (`true` if `@vitejs/devtools` is installed)
518+
- **Default:** `false`
519519

520520
Enable devtools integration for visualizing the internal state and build analysis.
521521
Ensure that `@vitejs/devtools` is installed as a dependency. This feature is currently supported only in build mode.

packages/vite/src/node/config.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ import {
8585
isNodeLikeBuiltin,
8686
isObject,
8787
isParentDirectory,
88-
isPkgInstalled,
8988
mergeAlias,
9089
mergeConfig,
9190
mergeWithDefaults,
@@ -513,8 +512,8 @@ export interface UserConfig extends DefaultEnvironmentOptions {
513512
/**
514513
* Enable devtools integration. Ensure that `@vitejs/devtools` is installed as a dependency.
515514
* This feature is currently supported only in build mode.
516-
* Defaults to true, if `@vitejs/devtools` is installed.
517515
* @experimental
516+
* @default false
518517
*/
519518
devtools?: boolean | DevToolsConfig
520519
}
@@ -748,14 +747,11 @@ export async function resolveDevToolsConfig(
748747
}> {
749748
const resolvedHostname = await resolveHostname(config.server?.host)
750749
const fallbackHostname = resolvedHostname.host ?? 'localhost'
751-
const isEnabled =
752-
config.devtools === true || !!(config.devtools && config.devtools.enabled)
753750

754751
return {
755752
enabled:
756-
config.devtools === false
757-
? false
758-
: isEnabled || isPkgInstalled('@vitejs/devtools/cli-commands'),
753+
config.devtools === true ||
754+
!!(config.devtools && config.devtools.enabled),
759755
config: {
760756
...(isObject(config.devtools) ? config.devtools : {}),
761757
host: isObject(config.devtools)

packages/vite/src/node/utils.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,11 +1774,3 @@ export function monotonicDateNow(): number {
17741774
lastDateNow++
17751775
return lastDateNow
17761776
}
1777-
1778-
export function isPkgInstalled(moduleName: string): boolean {
1779-
try {
1780-
import.meta.resolve(moduleName)
1781-
return true
1782-
} catch {}
1783-
return false
1784-
}

playground/devtools/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineConfig } from 'vite'
33
export default defineConfig({
44
base: '/',
55
devtools: {
6-
enabled: true,
6+
enabled: false,
77
port: 5173,
88
},
99
})

0 commit comments

Comments
 (0)