Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit cd71414

Browse files
committed
fix: inject inspector client manually to ensure devtools hook register normally
1 parent f5ac779 commit cd71414

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

packages/client/logic/hook.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ function subscribeHook() {
1313
const client = useDevToolsClient()
1414
const hook = client.value.hook
1515
hook.on(DevToolsHooks.APP_INIT, (app) => {
16-
if (app?._vueDevtools_hidden_)
16+
if (!app || app._instance.type?.devtools?.hide)
1717
return
18+
1819
vueApp.value = app
1920
instance.value = app._instance
2021
})

packages/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"execa": "^7.2.0",
5858
"sirv": "^2.0.3",
5959
"vite-plugin-inspect": "^0.7.35",
60-
"vite-plugin-vue-inspector": "^3.5.0"
60+
"vite-plugin-vue-inspector": "^3.6.0"
6161
},
6262
"devDependencies": {
6363
"@types/node": "^20.4.8",

packages/node/src/vite.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ export default function VitePluginVueDevTools(options?: VitePluginVueDevToolsOpt
178178
src: '/@id/virtual:vue-devtools-path:app.js',
179179
},
180180
},
181+
// inject inspector script manually to ensure it's loaded after vue-devtools
182+
{
183+
tag: 'script',
184+
injectTo: 'head',
185+
attrs: {
186+
type: 'module',
187+
src: '/@id/virtual:vue-inspector-path:load.js',
188+
},
189+
},
181190
],
182191
}
183192
},
@@ -187,10 +196,11 @@ export default function VitePluginVueDevTools(options?: VitePluginVueDevToolsOpt
187196

188197
return [
189198
VueInspector({
199+
lazyLoad: pluginOptions.appendTo ? 200 : false,
190200
toggleComboKey: '',
191201
toggleButtonVisibility: 'never',
192202
openInEditorHost: pluginOptions.openInEditorHost,
193-
...(pluginOptions.appendTo ? { appendTo: pluginOptions.appendTo } : {}),
203+
appendTo: pluginOptions.appendTo || 'manually',
194204
}),
195205
plugin,
196206
inspect,

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)