-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsvelte.config.js
44 lines (41 loc) · 1013 Bytes
/
svelte.config.js
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 vercelAdapter from '@sveltejs/adapter-vercel';
import nodeAdapter from '@sveltejs/adapter-node';
import autoAdapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [vitePreprocess()],
kit: {
adapter: getAdapter(),
csrf: {
checkOrigin: true
},
alias: {
'@/*': './src/lib/*',
'$src/*': './src/*'
}
}
};
function getAdapter() {
if (process.env.MODE === 'production' && process.env.VERCEL_ENV === 'production') {
return vercelAdapter({
runtime: 'edge',
regions: 'fra1',
split: true,
images: {
sizes: [640, 828, 1200, 1920, 3840],
formats: ['image/avif', 'image/webp'],
minimumCacheTTL: 300,
domains: [process.env.BASE_URL]
}
});
} else if (
process.env.MODE === 'production' &&
process.env.RAILWAY_ENVIRONMENT_NAME === 'production'
) {
return nodeAdapter();
} else {
return autoAdapter();
}
}
export default config;