File tree 3 files changed +7
-4
lines changed
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 9
9
UnionToIntersection ,
10
10
isFunction ,
11
11
} from './utils'
12
- import Vue$1 from 'vue'
12
+ import type Vue$1 from 'vue'
13
13
14
14
let vueDependency : VueConstructor | undefined = undefined
15
15
Original file line number Diff line number Diff line change 1
- import Vue from 'vue '
1
+ import { getRegisteredVueOrDefault } from '../runtimeContext '
2
2
3
3
const toString = ( x : any ) => Object . prototype . toString . call ( x )
4
4
@@ -99,7 +99,9 @@ export function isUndef(v: any): boolean {
99
99
}
100
100
101
101
export function warn ( msg : string , vm ?: Vue ) {
102
- Vue . util . warn ( msg , vm )
102
+ const Vue = getRegisteredVueOrDefault ( )
103
+ if ( ! Vue || ! Vue . util ) console . warn ( `[vue-composition-api] ${ msg } ` )
104
+ else Vue . util . warn ( msg , vm )
103
105
}
104
106
105
107
export function logError ( err : Error , vm : Vue , info : string ) {
Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ import {
8
8
shallowReactive ,
9
9
nextTick ,
10
10
} from '../../../src'
11
- import Vue from 'vue '
11
+ import { getRegisteredVueOrDefault } from '../../../src/runtimeContext '
12
12
13
13
// reference: https://vue-composition-api-rfc.netlify.com/api.html#watch
14
14
15
15
describe ( 'api: watch' , ( ) => {
16
+ const Vue = getRegisteredVueOrDefault ( )
16
17
// const warnSpy = jest.spyOn(console, 'warn');
17
18
const warnSpy = jest . spyOn ( ( Vue as any ) . util , 'warn' )
18
19
You can’t perform that action at this time.
0 commit comments