]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: init devtools after feature flag checks
authorEvan You <yyx990803@gmail.com>
Wed, 24 Feb 2021 20:59:38 +0000 (15:59 -0500)
committerEvan You <yyx990803@gmail.com>
Wed, 24 Feb 2021 20:59:38 +0000 (15:59 -0500)
packages/runtime-core/src/renderer.ts
packages/vue/src/dev.ts
packages/vue/src/index.ts
packages/vue/src/runtime.ts

index 898ae077d78cf0c171ce799fa98339fe3f42e574..bc1d154527bce0201d417429b9f44c3b33aa6220 100644 (file)
@@ -36,7 +36,8 @@ import {
   NOOP,
   hasOwn,
   invokeArrayFns,
-  isArray
+  isArray,
+  getGlobalThis
 } from '@vue/shared'
 import {
   queueJob,
@@ -75,7 +76,8 @@ import { ComponentPublicInstance } from './componentPublicInstance'
 import {
   devtoolsComponentAdded,
   devtoolsComponentRemoved,
-  devtoolsComponentUpdated
+  devtoolsComponentUpdated,
+  setDevtoolsHook
 } from './devtools'
 import { initFeatureFlags } from './featureFlags'
 import { isAsyncWrapper } from './apiAsyncComponent'
@@ -430,6 +432,12 @@ function baseCreateRenderer(
     initFeatureFlags()
   }
 
+  if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
+    const target = getGlobalThis()
+    target.__VUE__ = true
+    setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__)
+  }
+
   const {
     insert: hostInsert,
     remove: hostRemove,
index d980d20a48b1c08f640c88931f2d14b7656d09de..99ba49a20851c03dcbd4846868be77498ad43e6a 100644 (file)
@@ -1,12 +1,6 @@
-import { setDevtoolsHook, initCustomFormatter } from '@vue/runtime-dom'
-import { getGlobalThis } from '@vue/shared'
+import { initCustomFormatter } from '@vue/runtime-dom'
 
 export function initDev() {
-  const target = getGlobalThis()
-
-  target.__VUE__ = true
-  setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__)
-
   if (__BROWSER__) {
     if (!__ESM_BUNDLER__) {
       console.info(
index 62445c0f411a8ddabcf11b1b88984382cec61cb6..4874bb0d5f2474af254ac342152cea921d8cb7a2 100644 (file)
@@ -7,7 +7,7 @@ import * as runtimeDom from '@vue/runtime-dom'
 import { isString, NOOP, generateCodeFrame, extend } from '@vue/shared'
 import { InternalRenderFunction } from 'packages/runtime-core/src/component'
 
-if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
+if (__DEV__) {
   initDev()
 }
 
index d69ab48b4f996cbd8508bab33e5e38d3ea57d616..1452fceb003156d749e6e11de3b078f5bcf2c30b 100644 (file)
@@ -3,7 +3,7 @@
 import { initDev } from './dev'
 import { warn } from '@vue/runtime-dom'
 
-if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
+if (__DEV__) {
   initDev()
 }