generated from voorhoede/head-start
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.ts
88 lines (85 loc) · 2.39 KB
/
astro.config.ts
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 { defineConfig, envField, passthroughImageService } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
import graphql from '@rollup/plugin-graphql';
import { isPreview } from './config/preview';
import preact from '@astrojs/preact';
const productionUrl = 'https://dutchdigitalagencies.com'; // overwrite if you have a custom domain
const localhostPort = 4323; // 4323 is "head" in T9
export const siteUrl = process.env.CF_PAGES
? process.env.CF_PAGES_BRANCH === 'main'
? productionUrl
: process.env.CF_PAGES_URL
: `http://localhost:${localhostPort}`;
// https://astro.build/config
export default defineConfig({
adapter: cloudflare({
platformProxy: {
enabled: true,
},
}),
env: {
schema: {
HEAD_START_PREVIEW_SECRET: envField.string({
context: 'server',
access: 'public',
default: process.env.HEAD_START_PREVIEW_SECRET,
}),
DATOCMS_READONLY_API_TOKEN: envField.string({
context: 'client',
access: 'public',
default: process.env.DATOCMS_READONLY_API_TOKEN,
}),
PUBLIC_IS_PRODUCTION: envField.boolean({
context: 'server',
access: 'public',
default: process.env.NODE_ENV === 'production',
}),
HEAD_START_PREVIEW: envField.boolean({
context: 'client',
access: 'public',
default: isPreview,
}),
MAILCHIMP_FORM_URL: envField.string({
context: 'client',
access: 'public',
default: process.env.MAILCHIMP_FORM_URL,
}),
MAILCHIMP_HONEYPOT_ID: envField.string({
context: 'client',
access: 'public',
default: process.env.MAILCHIMP_HONEYPOT_ID,
}),
},
},
image: {
// cloudflare is not supported by the Astro image service
// @see https://docs.astro.build/en/guides/images/#configure-no-op-passthrough-service
service: passthroughImageService(),
},
integrations: [
preact({
compat: true,
}),
],
output: 'server',
server: { port: localhostPort },
site: siteUrl,
trailingSlash: 'always',
vite: {
plugins: [graphql()],
ssr: {
noExternal: [
'@tanstack/react-query',
'react-focus-on',
'react-datocms',
// @headlessui/react related dependencies
'@headlessui/react',
'@floating-ui/*',
'@react-aria/*',
],
},
},
devToolbar: {
enabled: false,
},
});