From: yuuang <569105585@qq.com> Date: Mon, 15 Nov 2021 03:04:46 +0000 (+0800) Subject: fix(devtool): improve devtools late injection browser env detection (#4890) X-Git-Tag: v3.2.22~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa2237f1d824eac511c4246135318594c48dc121;p=thirdparty%2Fvuejs%2Fcore.git fix(devtool): improve devtools late injection browser env detection (#4890) --- diff --git a/packages/runtime-core/src/devtools.ts b/packages/runtime-core/src/devtools.ts index 878bb68bfe..6bbd3db6e7 100644 --- a/packages/runtime-core/src/devtools.ts +++ b/packages/runtime-core/src/devtools.ts @@ -55,7 +55,10 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) { // (#4815) // eslint-disable-next-line no-restricted-globals 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__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [])