build: make watch tree-shakable in lean build

This commit is contained in:
Evan You 2020-02-17 11:02:15 -05:00
parent 77103e1fd7
commit 0c1fe72dcf

View File

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