-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
svelte.config.js
41 lines (38 loc) · 1.09 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
36
37
38
39
40
41
import adapterAuto from '@sveltejs/adapter-auto'
import adapterNode from '@sveltejs/adapter-node'
import adapterStatic from '@sveltejs/adapter-static'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import { mdsvex } from 'mdsvex'
import mdsvexConfig from './mdsvex.config.js'
const adapter = {
auto: adapterAuto(),
node: adapterNode(),
static: adapterStatic({
assets: 'build',
fallback: undefined,
pages: 'build',
}),
}
/** @type {import("@sveltejs/kit").Config} */
export default {
extensions: ['.svelte', ...(mdsvexConfig.extensions ?? [])],
kit: {
adapter:
process.env.ADAPTER
// @ts-expect-error adapter types
? adapter[process.env.ADAPTER.toLowerCase()]
: Object.keys(process.env).some(key => ['NETLIFY', 'VERCEL'].includes(key))
? adapter.auto
: adapter.static,
csp: {
directives: {
'style-src': ['self', 'unsafe-inline', 'https://giscus.app'],
},
mode: 'auto',
},
prerender: {
handleMissingId: 'warn',
},
},
preprocess: [mdsvex(mdsvexConfig), vitePreprocess()],
}