-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
88 lines (82 loc) · 2.2 KB
/
astro.config.mjs
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
import react from "@astrojs/react"
import sitemap from "@astrojs/sitemap"
import tailwind from "@astrojs/tailwind"
import compress from "astro-compress"
import icon from "astro-icon"
import { defineConfig } from "astro/config"
import { config } from "/src/settings"
import sanity from "@sanity/astro"
import { loadEnv } from "vite"
const {
PUBLIC_SANITY_STUDIO_PROJECT_ID,
PUBLIC_SANITY_STUDIO_DATASET,
PUBLIC_SANITY_PROJECT_ID,
PUBLIC_SANITY_DATASET,
} = loadEnv(import.meta.env.MODE, process.cwd(), "")
// Different environments use different variables
const projectId = PUBLIC_SANITY_STUDIO_PROJECT_ID || PUBLIC_SANITY_PROJECT_ID
const dataset = PUBLIC_SANITY_STUDIO_DATASET || PUBLIC_SANITY_DATASET
import vercel from "@astrojs/vercel/serverless"
export default defineConfig({
site: `${config.site.base.url}`,
prefetch: {
prefetchAll: true,
defaultStrategy: "viewport",
},
integrations: [
sitemap({
filter: page => page !== `${config.site.base.url}/studio`,
}),
tailwind({
applyBaseStyles: false,
}),
sanity({
projectId,
dataset,
studioBasePath: "/studio",
useCdn: false,
apiVersion: "2023-03-20",
}),
compress(),
react(),
icon(),
],
// git
// plugins: [
// VitePWA({
// registerType: "autoUpdate",
// manifest,
// includeAssets: ["favicon.svg"],
// workbox: {
// globDirectory: "dist",
// globPatterns: [
// "**/*.{js,html,css,svg,png,jpg,jpeg,gif,webp,woff,woff2,ttf,eot,ico}",
// ],
// navigateFallback: "/",
// runtimeCaching: [
// {
// urlPattern: ({ request }) => request.destination === "image",
// handler: "CacheFirst", // Кэшируем изображения
// options: {
// cacheName: "image-cache",
// expiration: {
// maxEntries: 50,
// maxAgeSeconds: 7 * 24 * 60 * 60, // Кэшируем на неделю
// },
// },
// },
// ],
// },
// devOptions: {
// enabled: import.meta.env.MODE === "development" ? true : false,
// navigateFallbackAllowlist: [/^\//],
// },
// experimental: {
// directoryAndTrailingSlashHandler: true,
// },
// }),
// ],
// },
output: "hybrid",
adapter: vercel(),
})