-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
48 lines (44 loc) · 1.03 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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import analog from '@analogjs/platform';
import { createClient } from 'contentful';
const client = createClient({
space: 'bk8otr7phnfm',
accessToken: 'NDf_OoMjD1VJo0siqo5Xy3jJy1pWCYLJgH089z7jt34',
environment: 'master',
});
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
publicDir: 'src/assets',
build: {
target: ['es2020'],
},
resolve: {
mainFields: ['module'],
},
plugins: [
analog({
nitro: {
serveStatic: false,
},
prerender: {
routes: async () => {
const pages = await client.getEntries({
content_type: 'page',
});
const routes = pages.items.map((page) => page.fields['slug'] || '');
return routes as any;
},
},
}),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['src/test.ts'],
include: ['**/*.spec.ts'],
},
define: {
'import.meta.vitest': mode !== 'production',
},
}));