fix(devtool): improve devtools late injection browser env detection (#4890)

This commit is contained in:
yuuang 2021-11-15 11:04:46 +08:00 committed by GitHub
parent e1ee3c4fe8
commit fa2237f1d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,10 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) {
// (#4815) // (#4815)
// eslint-disable-next-line no-restricted-globals // eslint-disable-next-line no-restricted-globals
typeof window !== 'undefined' && typeof window !== 'undefined' &&
!navigator.userAgent.includes('jsdom') // some envs mock window but not fully
window.HTMLElement &&
// also exclude jsdom
!window.navigator?.userAgent?.includes('jsdom')
) { ) {
const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ = const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []) target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [])