-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathastro.config.ts
More file actions
96 lines (91 loc) · 2.21 KB
/
Copy pathastro.config.ts
File metadata and controls
96 lines (91 loc) · 2.21 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import partytown from '@astrojs/partytown';
import react from '@astrojs/react';
import sitemap from '@astrojs/sitemap';
import vercel from '@astrojs/vercel';
import sanity from '@sanity/astro';
import tailwindcss from '@tailwindcss/vite';
import robotsTxt from 'astro-robots-txt';
import webmanifest from 'astro-webmanifest';
import { defineConfig } from 'astro/config';
import serviceWorker from 'astrojs-service-worker';
import { loadEnv } from 'vite';
import { siteConfig } from './src/lib/config/site';
const { PUBLIC_SANITY_PROJECT_ID, PUBLIC_SANITY_DATASET } = loadEnv(
import.meta.env.MODE,
process.cwd(),
'',
);
if (!PUBLIC_SANITY_PROJECT_ID || !PUBLIC_SANITY_DATASET)
throw new Error(
'Both environment variables PUBLIC_SANITY_PROJECT_ID and PUBLIC_SANITY_DATASET must be set in order for the site to properly function',
);
const { name, backgroundColor, themeColor, url } = siteConfig;
// https://astro.build/config
const config = defineConfig({
site: url,
i18n: {
locales: ['en', 'de'],
defaultLocale: 'en',
routing: {
prefixDefaultLocale: false,
},
},
adapter: vercel({
webAnalytics: {
enabled: true,
},
}),
prefetch: {
prefetchAll: true,
},
image: {
domains: ['cdn.sanity.io'],
},
experimental: {
clientPrerender: true,
},
vite: {
plugins: [tailwindcss()],
},
integrations: [
sanity({
projectId: PUBLIC_SANITY_PROJECT_ID,
dataset: PUBLIC_SANITY_DATASET,
useCdn: false,
studioBasePath: '/admin',
}),
react(),
partytown({
config: {
forward: ['dataLayer.push'],
},
}),
serviceWorker(),
sitemap({
i18n: {
defaultLocale: 'en',
locales: {
en: 'en',
de: 'de',
},
},
}),
robotsTxt(),
webmanifest({
name,
short_name: name,
background_color: backgroundColor,
theme_color: themeColor,
display: 'standalone',
prefer_related_applications: true,
start_url: '/',
icon: './public/favicon.svg',
config: {
outfile: 'site.webmanifest',
iconPurpose: ['any', 'maskable'],
insertAppleTouchLinks: true,
},
}),
],
});
export default config;