-
Notifications
You must be signed in to change notification settings - Fork 1
/
astro.config.mjs
51 lines (49 loc) · 1.48 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
import { defineConfig, sharpImageService, envField } from 'astro/config'
import path from 'path'
import { fileURLToPath } from 'url'
import { loadEnv } from 'vite'
import icon from 'astro-icon'
import sitemap from '@astrojs/sitemap'
import tailwind from '@astrojs/tailwind'
import robotsTxt from 'astro-robots-txt'
import { SITE } from './src/config.mjs'
import netlify from '@astrojs/netlify'
import pagefind from 'astro-pagefind'
const { SUBDOMAIN, PREVIEW } = loadEnv(process.env.NODE_ENV, process.cwd(), '')
const __dirname = path.dirname(fileURLToPath(import.meta.url))
// https://astro.build/config
export default defineConfig({
site: import.meta.env.PROD ? `https://${SUBDOMAIN}.sv-eutingen.de/` : `http://localhost:4321/`,
base: SITE.basePathname,
trailingSlash: SITE.trailingSlash ? 'always' : 'never',
output: 'static',
adapter: netlify(),
integrations: [
tailwind(),
icon({
iconDir: 'src/assets/icons',
}),
sitemap(),
robotsTxt({
policy: PREVIEW === 'true' ? [{ userAgent: '*', disallow: '/' }] : undefined,
}),
pagefind(),
],
image: {
service: sharpImageService(),
},
env: {
schema: {
SUBDOMAIN: envField.string({ context: 'server', access: 'public' }),
BACKEND_API: envField.string({ context: 'client', access: 'public' }),
PREVIEW: envField.boolean({ context: 'client', access: 'public' }),
},
},
vite: {
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
},
})