-
Notifications
You must be signed in to change notification settings - Fork 2
/
astro.config.ts
40 lines (34 loc) · 890 Bytes
/
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
import { defineConfig, getViteConfig } from 'astro/config'
import type { AstroUserConfig } from 'astro/config'
import { readFileSync } from 'node:fs'
import node from '@astrojs/node'
import preact from '@astrojs/preact'
import { getServerEnv } from './src/features/infra/env.mjs'
const { environment, baseUrl } = getServerEnv()
const vite = getViteConfig({
ssr: {
noExternal: ['open-props']
}
})
if (environment.isDev) {
vite.server = {
https: {
key: readFileSync('./localhost-key.pem', 'utf8'),
cert: readFileSync('./localhost.pem', 'utf8')
}
}
}
// https://astro.build/config
const astro: AstroUserConfig = {
output: 'server',
adapter: node({
mode: 'middleware'
}),
vite,
integrations: [preact({ compat: true })]
}
if (baseUrl) {
// Remove trailing slash
astro.site = baseUrl.replace(/\/$/, '')
}
export default defineConfig(astro)