-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
56 lines (54 loc) · 1.58 KB
/
vite.config.ts
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
55
56
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import codegen from 'vite-plugin-graphql-codegen'
// https://vitejs.dev/config/
export default ({ mode }: any) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
return defineConfig({
plugins: [
vue(),
codegen({
runOnBuild: false,
config: {
schema: [
{
[`${process.env.VITE_PUBLIC_SUPABASE_URL}/graphql/v1`]: {
headers: {
apiKey: process.env.VITE_PUBLIC_SUPABASE_ANON_KEY ?? ''
}
}
}
],
documents: 'src/graphql/**/*.ts',
config: {
preResolveTypes: true
},
generates: {
'src/types/graphql.types.ts': {
plugins: ['typescript', 'typescript-operations', 'typescript-vue-apollo'],
config: {
typesPrefix: 'I',
skipTypename: true,
operationResultSuffix: 'Result',
flattenGeneratedTypesIncludeFragments: true,
dedupeOperationSuffix: true,
useTypeImports: true,
vueCompositionApiImportFrom: 'vue',
withCompositionFunctions: true
}
}
},
hooks: {
afterOneFileWrite: ['prettier --write']
}
}
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})
}