-
-
Notifications
You must be signed in to change notification settings - Fork 216
Expand file tree
/
Copy pathvite.config.ts
More file actions
54 lines (52 loc) · 1.61 KB
/
Copy pathvite.config.ts
File metadata and controls
54 lines (52 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { join } from 'path';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
export default defineConfig(({ mode }) => {
const usesLegacyGraphQL = /^graphql-(?:14|15|16)$/.test(mode);
const graphqlPackage = usesLegacyGraphQL ? mode : 'graphql';
return {
resolve: {
alias: [
{
find: /^graphql$/,
replacement: join(__dirname, `node_modules/${graphqlPackage}/index.mjs`),
},
...(usesLegacyGraphQL
? [
{
find: /^graphql\/(.*)$/,
replacement: join(__dirname, `node_modules/${graphqlPackage}/$1`),
},
]
: []),
],
},
test: {
globals: true,
alias: {
'@graphql-inspector/commands': 'packages/commands/commands/src/index.ts',
'@graphql-inspector/loaders': 'packages/loaders/loaders/src/index.ts',
'@graphql-inspector/logger': 'packages/logger/src/index.ts',
'@graphql-inspector/url-loader': 'packages/loaders/url/src/index.ts',
'@graphql-inspector/testing': 'packages/testing/src/index.ts',
'@graphql-inspector/core': 'packages/core/src/index.ts',
'@graphql-inspector/patch': 'packages/patch/src/index.ts',
},
setupFiles: ['./packages/testing/src/setup-file.ts'],
...(usesLegacyGraphQL
? {
server: {
deps: {
inline: true,
},
},
}
: {}),
},
plugins: [
tsconfigPaths({
projects: [join(__dirname, 'tsconfig.test.json')],
}),
],
};
});