File tree Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Original file line number Diff line number Diff line change
1
+ // Global compile-time constants
2
+ declare var __TEST__ : boolean
Original file line number Diff line number Diff line change @@ -8,20 +8,24 @@ export * from 'pinia'
8
8
9
9
export const usePinia = ( ) => useNuxtApp ( ) . $pinia as Pinia | undefined
10
10
11
- export const defineStore : typeof _defineStore = (
12
- ...args : [ idOrOptions : any , setup ?: any , setupOptions ?: any ]
13
- ) => {
14
- if ( ! import . meta. server ) {
15
- return _defineStore ( ...args )
16
- }
11
+ export const defineStore : typeof _defineStore =
12
+ process . env . NODE_ENV === 'production' && ! __TEST__
13
+ ? _defineStore
14
+ : ( ...args : [ idOrOptions : any , setup ?: any , setupOptions ?: any ] ) => {
15
+ if ( ! import . meta. server ) {
16
+ return _defineStore ( ...args )
17
+ }
17
18
18
- const originalUseStore = _defineStore ( ...args )
19
- function useStore ( pinia ?: Pinia | null , hot ?: StoreGeneric ) : StoreGeneric {
20
- return originalUseStore ( pinia || usePinia ( ) , hot )
21
- }
19
+ const originalUseStore = _defineStore ( ...args )
20
+ function useStore (
21
+ pinia ?: Pinia | null ,
22
+ hot ?: StoreGeneric
23
+ ) : StoreGeneric {
24
+ return originalUseStore ( pinia || usePinia ( ) , hot )
25
+ }
22
26
23
- useStore . $id = originalUseStore . $id
24
- useStore . _pinia = originalUseStore . _pinia
27
+ useStore . $id = originalUseStore . $id
28
+ useStore . _pinia = originalUseStore . _pinia
25
29
26
- return useStore
27
- }
30
+ return useStore
31
+ }
Original file line number Diff line number Diff line change 2
2
"extends" : " ./playground/.nuxt/tsconfig.json" ,
3
3
"include" : [
4
4
" ./shims.d.ts" ,
5
+ " ./global.d.ts" ,
5
6
// missing in the playground
6
7
" ./src"
7
8
]
You can’t perform that action at this time.
0 commit comments