-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
35 lines (31 loc) · 921 Bytes
/
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
import { defineConfig } from 'astro/config';
import { fileURLToPath } from 'url';
import path, { dirname } from 'node:path';
import preact from '@astrojs/preact';
import vercel from '@astrojs/vercel/serverless';
const NODE_ENV = process.env?.NODE_ENV ?? 'production';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// vercel build config for stage and prod.
const vercelBuildConfig = {
output: 'server',
adapter: vercel(),
};
// https://astro.build/config
export default defineConfig({
// Enable Preact to support Preact JSX components.
integrations: [preact({ compat: true })],
// Enable SSR on Vercel.
...(NODE_ENV !== 'development' ? vercelBuildConfig : {}),
// Custom vite configuration.
vite: {
ssr: {
noExternal: ['modern-css-reset'],
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
},
});