-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
80 lines (78 loc) · 2.05 KB
/
astro.config.mjs
File metadata and controls
80 lines (78 loc) · 2.05 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
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import react from '@astrojs/react';
import mdx from '@astrojs/mdx';
import cloudflare from '@astrojs/cloudflare';
// i18n locale configuration (synced with i18n/config.ts)
const SUPPORTED_LOCALES = ['en'];
const DEFAULT_LOCALE = 'en';
// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: cloudflare({
// Cloudflare Pages configuration
imageService: 'sharp',
}),
integrations: [
react({
// Enable React for client-side islands
experimentalReactChildren: true,
}),
tailwind({
// Apply Tailwind CSS to all files
applyBaseStyles: false,
}),
mdx({
// MDX configuration for blog posts
optimize: true,
}),
],
i18n: {
defaultLocale: DEFAULT_LOCALE,
locales: SUPPORTED_LOCALES,
routing: {
// Don't prefix default locale (en) in URLs
prefixDefaultLocale: false,
},
},
vite: {
// Preserve existing path aliases
resolve: {
alias: {
'@/*': './*',
'@src/*': './src/*',
'@i18n/*': './i18n/*',
'@shared/*': './shared/*',
'@server/*': './server/*',
'@client/*': './client/*',
'@lib/*': './lib/*',
'@locales/*': './locales/*',
'@app/*': './app/*',
// Fix for React 18.2.x + Vite 6 + @astrojs/react compatibility
// Map server.edge to server.browser for React 18.2 compatibility
'react-dom/server.edge': 'react-dom/server.browser',
},
},
},
// Ensure trailing slashes are handled correctly
trailingSlash: 'ignore',
// Build configuration
build: {
// Inline stylesheets under a threshold
inlineStylesheets: 'auto',
},
// Security headers are applied in middleware
// Image optimization (uses sharp in Cloudflare Workers)
image: {
remotePatterns: [
{
protocol: 'https',
hostname: 'api.dicebear.com',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
},
],
},
});