-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
68 lines (61 loc) · 1.72 KB
/
astro.config.mjs
File metadata and controls
68 lines (61 loc) · 1.72 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
// @ts-check
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import react from '@astrojs/react';
import vercel from '@astrojs/vercel';
import netlify from '@astrojs/netlify';
import { FALLBACK_SITE_URL, normalizeCanonicalSiteUrl } from './src/lib/url/canonical-site.js';
const normalizedAdapter = process.env.ASTRO_ADAPTER?.trim().toLowerCase();
const platformAdapter = process.env.NETLIFY
? 'netlify'
: 'vercel';
const resolvedAdapter = normalizedAdapter === 'netlify' || normalizedAdapter === 'vercel'
? normalizedAdapter
: platformAdapter;
const NETLIFY_EXCLUDE_FILES = [
'./.git/**',
'./.netlify/v1/**',
'./.netlify/functions/**',
'./.netlify/functions-internal/**',
'./.vercel/**',
'./docs/**',
'./external_docs/**',
'./release/**',
'./tests/**',
'./**/.DS_Store'
];
const adapter = resolvedAdapter === 'netlify'
? netlify({ excludeFiles: NETLIFY_EXCLUDE_FILES })
: vercel();
const resolvedSiteUrl = normalizeCanonicalSiteUrl(process.env.SITE_URL) || FALLBACK_SITE_URL;
// https://astro.build/config
export default defineConfig({
site: resolvedSiteUrl,
output: 'server', // Enable server-side rendering for API routes
adapter,
prefetch: {
prefetchAll: false,
defaultStrategy: 'viewport'
},
vite: {
plugins: [tailwindcss()],
build: {
// Keep script assets as file URLs (never inline as data: URIs),
// so strict CSP script-src 'self' continues to work.
assetsInlineLimit: 0
}
},
integrations: [
react({
include: ['**/react/*', '**/components/**/*.tsx', '**/components/**/*.jsx']
})
],
image: {
remotePatterns: [
{
protocol: 'https',
hostname: '**.supabase.co'
}
]
}
});