]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
build: make watch tree-shakable in lean build
authorEvan You <yyx990803@gmail.com>
Mon, 17 Feb 2020 16:02:15 +0000 (11:02 -0500)
committerEvan You <yyx990803@gmail.com>
Mon, 17 Feb 2020 16:02:15 +0000 (11:02 -0500)
packages/runtime-core/src/componentProxy.ts

index 5d8d4364a6353e820329295f59f26cd72e69d8fc..b2ff4baada17fe4c9e9e95ad611bdfa05e7fb21e 100644 (file)
@@ -1,7 +1,7 @@
 import { ComponentInternalInstance, Data, Emit } from './component'
 import { nextTick, queueJob } from './scheduler'
 import { instanceWatch } from './apiWatch'
-import { EMPTY_OBJ, hasOwn, isGloballyWhitelisted } from '@vue/shared'
+import { EMPTY_OBJ, hasOwn, isGloballyWhitelisted, NOOP } from '@vue/shared'
 import {
   ExtractComputedReturns,
   ComponentOptionsBase,
@@ -63,7 +63,7 @@ const publicPropertiesMap: Record<
   $options: i => i.type,
   $forceUpdate: i => () => queueJob(i.update),
   $nextTick: () => nextTick,
-  $watch: i => instanceWatch.bind(i)
+  $watch: __FEATURE_OPTIONS__ ? i => instanceWatch.bind(i) : NOOP
 }
 
 const enum AccessTypes {