Skip to content

Commit deb1295

Browse files
committed
fix: deps browser hash compatibility
1 parent 2384495 commit deb1295

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

example/vue2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"devDependencies": {
1414
"sass": "^1.49.9",
1515
"typescript": "^4.5.2",
16-
"vite": "^2.7.1",
16+
"vite": "2.9.1",
1717
"vite-plugin-vue-inspector": "0.2.5",
1818
"vite-plugin-vue2": "^1.9.3"
1919
}

example/vue3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@vue/compiler-sfc": "^3.2.24",
1515
"sass": "^1.49.9",
1616
"typescript": "^4.5.2",
17-
"vite": "^2.7.1",
17+
"vite": "2.9.1",
1818
"vite-plugin-vue-inspector": "0.2.5"
1919
}
2020
}

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ function VitePluginInspector(options: VitePluginInspectorOptions = { vue: 3, ena
3232
server.middlewares.use(launchEditorMiddleware)
3333
},
3434
transformIndexHtml(html, { server }) {
35+
const _server = server as any
36+
const browserHash = _server?._optimizedDeps?.metadata?.browserHash ?? _server?._optimizeDepsMetadata?.browserHash ?? ""
3537
return {
3638
html,
3739
tags: [{
@@ -44,7 +46,7 @@ function VitePluginInspector(options: VitePluginInspectorOptions = { vue: 3, ena
4446
type: "module",
4547
},
4648
children: normalizeOverlayScripts({
47-
hash: (server as any)._optimizeDepsMetadata.browserHash,
49+
hash: browserHash,
4850
scripts,
4951
}),
5052
injectTo: "body",

0 commit comments

Comments
 (0)