File tree 5 files changed +22
-0
lines changed
test-dep-conditions-indirect
5 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 3
3
"type" : " module" ,
4
4
"private" : true ,
5
5
"exports" : {
6
+ "./custom" : {
7
+ "custom" : " ./true.js" ,
8
+ "default" : " ./false.js"
9
+ },
6
10
"./module" : {
7
11
"module" : " ./true.js" ,
8
12
"default" : " ./false.js"
Original file line number Diff line number Diff line change
1
+ import conditionCustom from '@vitest/test-dep-conditions-indirect/custom'
1
2
import conditionDevelopment from '@vitest/test-dep-conditions-indirect/development'
2
3
import conditionModule from '@vitest/test-dep-conditions-indirect/module'
3
4
import conditionNode from '@vitest/test-dep-conditions-indirect/node'
4
5
import conditionProductioin from '@vitest/test-dep-conditions-indirect/production'
5
6
6
7
export default {
8
+ conditionCustom,
7
9
conditionModule,
8
10
conditionNode,
9
11
conditionDevelopment,
Original file line number Diff line number Diff line change 3
3
"type" : " module" ,
4
4
"private" : true ,
5
5
"exports" : {
6
+ "./custom" : {
7
+ "custom" : " ./true.js" ,
8
+ "default" : " ./false.js"
9
+ },
6
10
"./module" : {
7
11
"module" : " ./true.js" ,
8
12
"default" : " ./false.js"
Original file line number Diff line number Diff line change 1
1
import { test , expect } from 'vitest' ;
2
+ import conditionCustom from '@vitest/test-dep-conditions/custom' ;
2
3
import conditionModule from '@vitest/test-dep-conditions/module' ;
3
4
import conditionNode from '@vitest/test-dep-conditions/node' ;
4
5
import conditionDevelopment from '@vitest/test-dep-conditions/development' ;
@@ -11,18 +12,21 @@ const viteMajor = Number(viteVersion.split('.')[0])
11
12
12
13
test ( 'conditions' , ( ) => {
13
14
expect ( {
15
+ conditionCustom,
14
16
conditionModule,
15
17
conditionNode,
16
18
conditionDevelopment,
17
19
conditionProduction,
18
20
indirect
19
21
} ) . toEqual (
20
22
{
23
+ conditionCustom : true ,
21
24
"conditionDevelopment" : true ,
22
25
"conditionModule" : viteMajor <= 5 ,
23
26
"conditionNode" : true ,
24
27
"conditionProduction" : false ,
25
28
"indirect" : {
29
+ conditionCustom : true ,
26
30
"conditionDevelopment" : true ,
27
31
"conditionModule" : viteMajor <= 5 && inline ,
28
32
"conditionNode" : true ,
Original file line number Diff line number Diff line change @@ -4,4 +4,12 @@ export default defineConfig({
4
4
define : {
5
5
'import.meta.__IS_INLINE__' : 'true' ,
6
6
} ,
7
+ resolve : {
8
+ conditions : [ 'custom' ] ,
9
+ } ,
10
+ ssr : {
11
+ resolve : {
12
+ conditions : [ 'custom' ] ,
13
+ } ,
14
+ }
7
15
} )
You can’t perform that action at this time.
0 commit comments