-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: apply
development|production
condition on Vite 6 (#7301)
Co-authored-by: Vladimir Sheremet <[email protected]>
- Loading branch information
1 parent
0b404e5
commit ef1464f
Showing
18 changed files
with
233 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default false |
27 changes: 27 additions & 0 deletions
27
test/config/deps/test-dep-conditions-indirect/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "@vitest/test-dep-conditions-indirect", | ||
"type": "module", | ||
"private": true, | ||
"exports": { | ||
"./custom": { | ||
"custom": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./module": { | ||
"module": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./node": { | ||
"node": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./development": { | ||
"development": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./production": { | ||
"production": "./true.js", | ||
"default": "./false.js" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import conditionCustom from '@vitest/test-dep-conditions-indirect/custom' | ||
import conditionDevelopment from '@vitest/test-dep-conditions-indirect/development' | ||
import conditionModule from '@vitest/test-dep-conditions-indirect/module' | ||
import conditionNode from '@vitest/test-dep-conditions-indirect/node' | ||
import conditionProductioin from '@vitest/test-dep-conditions-indirect/production' | ||
|
||
export default { | ||
conditionCustom, | ||
conditionModule, | ||
conditionNode, | ||
conditionDevelopment, | ||
conditionProductioin, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default !!import.meta.__IS_INLINE__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "@vitest/test-dep-conditions", | ||
"type": "module", | ||
"private": true, | ||
"exports": { | ||
"./custom": { | ||
"custom": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./module": { | ||
"module": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./node": { | ||
"node": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./development": { | ||
"development": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./production": { | ||
"production": "./true.js", | ||
"default": "./false.js" | ||
}, | ||
"./inline": "./inline.js", | ||
"./indirect": "./indirect.js" | ||
}, | ||
"dependencies": { | ||
"@vitest/test-dep-conditions-indirect": "file:../test-dep-conditions-indirect" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { test, expect } from 'vitest'; | ||
import conditionCustom from '@vitest/test-dep-conditions/custom'; | ||
import conditionModule from '@vitest/test-dep-conditions/module'; | ||
import conditionNode from '@vitest/test-dep-conditions/node'; | ||
import conditionDevelopment from '@vitest/test-dep-conditions/development'; | ||
import conditionProduction from '@vitest/test-dep-conditions/production'; | ||
import inline from '@vitest/test-dep-conditions/inline'; | ||
import indirect from '@vitest/test-dep-conditions/indirect'; | ||
|
||
import { viteVersion } from 'vitest/node' | ||
const viteMajor = Number(viteVersion.split('.')[0]) | ||
|
||
test('conditions', () => { | ||
expect({ | ||
conditionCustom, | ||
conditionModule, | ||
conditionNode, | ||
conditionDevelopment, | ||
conditionProduction, | ||
indirect | ||
}).toEqual( | ||
{ | ||
conditionCustom: true, | ||
"conditionDevelopment": true, | ||
"conditionModule": viteMajor <= 5, | ||
"conditionNode": true, | ||
"conditionProduction": false, | ||
"indirect": { | ||
conditionCustom: true, | ||
"conditionDevelopment": true, | ||
"conditionModule": viteMajor <= 5 && inline, | ||
"conditionNode": true, | ||
"conditionProductioin": false, | ||
}, | ||
} | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineConfig } from "vitest/config" | ||
|
||
export default defineConfig({ | ||
define: { | ||
'import.meta.__IS_INLINE__': 'true', | ||
}, | ||
resolve: { | ||
conditions: ['custom'], | ||
}, | ||
ssr: { | ||
resolve: { | ||
conditions: ['custom'], | ||
}, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters