-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvelte.config.js
35 lines (32 loc) · 1.04 KB
/
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
import adapterNode from '@sveltejs/adapter-node';
import adapterStatic from '@sveltejs/adapter-static';
import adapterVercel from '@sveltejs/adapter-vercel';
import adapterNetlify from '@sveltejs/adapter-netlify';
import adapterCloudflare from '@sveltejs/adapter-cloudflare';
import preprocess from 'svelte-preprocess';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: preprocess(),
kit: {
adapter: getAdapter(),
csp: { mode: 'auto' },
},
};
function getAdapter() {
if (Object.keys(process.env).some((key) => key.includes('VERCEL'))) {
return adapterVercel();
} else if (Object.keys(process.env).some((key) => key.includes('NETLIFY'))) {
return adapterNetlify();
} else if (Object.keys(process.env).some((key) => key.includes('CF_PAGES'))) {
return adapterCloudflare();
} else {
return process.env.ADAPTER === 'node'
? adapterNode({ out: 'build' })
: adapterStatic({
pages: 'build',
assets: 'build',
fallback: null,
});
}
}
export default config;