-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
astro.config.mjs
44 lines (40 loc) · 1.21 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
import process from 'node:process'
import cloudflare from '@astrojs/cloudflare'
import netlify from '@astrojs/netlify'
import node from '@astrojs/node'
import react from '@astrojs/react'
import tailwind from '@astrojs/tailwind'
import vercel from '@astrojs/vercel'
import { defineConfig } from 'astro/config'
import { provider } from 'std-env'
const providers = {
vercel: vercel({
edgeMiddleware: false,
}),
cloudflare_pages: cloudflare(),
netlify: netlify({
edgeMiddleware: false,
}),
node: node({
mode: 'standalone',
}),
}
const adapterProvider = process.env.SERVER_ADAPTER || provider
export default defineConfig({
adapter: providers[adapterProvider] || providers.node,
integrations: [tailwind(), react()],
vite: {
ssr: {
noExternal: process.env.DOCKER ? !!process.env.DOCKER : undefined,
},
resolve: {
// Use react-dom/server.edge instead of react-dom/server.browser for React 19.
// Without this, MessageChannel from node:worker_threads needs to be polyfilled.
alias: import.meta.env.PROD
&& (adapterProvider === 'cloudflare_pages' || process.env.DOCKER)
&& {
'react-dom/server': 'react-dom/server.edge',
},
},
},
})