-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
53 lines (48 loc) · 1.62 KB
/
Copy pathastro.config.mjs
File metadata and controls
53 lines (48 loc) · 1.62 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
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import icon from 'astro-icon';
import tailwindcss from '@tailwindcss/vite';
import { siteConfig } from './src/config';
// Site URL from environment variable with localhost fallback
const siteUrl = process.env.SITE_URL || 'http://localhost:4321';
// Custom integration to warn about missing environment variables after build
function envCheckIntegration() {
return {
name: 'env-check',
hooks: {
'astro:build:done': () => {
if (!process.env.SITE_URL) {
console.warn('='.repeat(60));
console.warn('WARNING: SITE_URL environment variable not set');
console.warn('Build completed with fallback URL: http://localhost:4321');
console.warn('For production, create .env file and set SITE_URL');
console.warn('='.repeat(60) + '\n');
}
},
},
};
}
export default defineConfig({
site: siteUrl,
integrations: [
mdx(),
icon(),
envCheckIntegration(),
sitemap({
filter: (page) => {
const { features } = siteConfig;
// Filter out pages based on feature flags
if (!features.blog && page.includes('/blog')) return false;
if (!features.docs && page.includes('/docs')) return false;
if (!features.changelog && page.includes('/changelog')) return false;
if (!features.testimonials && page.includes('/testimonials')) return false;
if (!features.roadmap && page.includes('/roadmap')) return false;
return true;
},
}),
],
vite: {
plugins: [tailwindcss()],
},
});