Skip to content

Commit aac3432

Browse files
committed
fix: guard openInEditor when inspector is unavailable
When the component inspector is not initialized, calling openInEditor through the Vite plugin path throws because __VUE_INSPECTOR__ is missing. Guard the call and log a clear warning instead, so DevTools does not crash in this state. Refs #824
1 parent 30e9ebc commit aac3432

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • packages/devtools-kit/src/core/open-in-editor

packages/devtools-kit/src/core/open-in-editor/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ export function openInEditor(options: OpenInEditorOptions = {}) {
2929
}
3030
else if (devtoolsState.vitePluginDetected) {
3131
const _baseUrl = target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ ?? baseUrl
32-
target.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column)
32+
if (target.__VUE_INSPECTOR__) {
33+
target.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column)
34+
}
35+
else {
36+
console.warn('[Vue DevTools] Component inspector is not available. If you have disabled the Options API, the component inspector may not be initialized.')
37+
}
3338
}
3439
}
3540
}

0 commit comments

Comments
 (0)