2023-09-14 22:18:39 +08:00
|
|
|
import adapterAuto from '@sveltejs/adapter-auto'
|
|
|
|
import adapterNode from '@sveltejs/adapter-node'
|
2021-11-04 15:34:01 +08:00
|
|
|
import adapterStatic from '@sveltejs/adapter-static'
|
2024-09-11 18:29:31 +08:00
|
|
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
2022-06-15 22:06:01 +08:00
|
|
|
import { mdsvex } from 'mdsvex'
|
2024-09-11 18:29:31 +08:00
|
|
|
|
2022-03-11 21:08:10 +08:00
|
|
|
import mdsvexConfig from './mdsvex.config.js'
|
2022-06-15 22:06:01 +08:00
|
|
|
|
2023-09-14 22:18:39 +08:00
|
|
|
const adapter = {
|
|
|
|
auto: adapterAuto(),
|
|
|
|
node: adapterNode(),
|
|
|
|
static: adapterStatic({
|
|
|
|
assets: 'build',
|
2024-09-11 18:29:31 +08:00
|
|
|
fallback: undefined,
|
|
|
|
pages: 'build',
|
|
|
|
}),
|
2023-09-14 22:18:39 +08:00
|
|
|
}
|
|
|
|
|
2024-09-11 14:50:40 +08:00
|
|
|
/** @type {import("@sveltejs/kit").Config} */
|
2023-05-01 23:32:11 +08:00
|
|
|
export default {
|
2024-09-11 14:50:40 +08:00
|
|
|
extensions: ['.svelte', ...(mdsvexConfig.extensions ?? [])],
|
2021-11-04 15:34:01 +08:00
|
|
|
kit: {
|
2024-02-10 17:16:26 +08:00
|
|
|
adapter:
|
2023-09-14 22:18:39 +08:00
|
|
|
process.env.ADAPTER
|
2024-09-11 14:50:40 +08:00
|
|
|
// @ts-expect-error adapter types
|
2023-09-14 22:18:39 +08:00
|
|
|
? adapter[process.env.ADAPTER.toLowerCase()]
|
2024-09-11 18:29:31 +08:00
|
|
|
: Object.keys(process.env).some(key => ['NETLIFY', 'VERCEL'].includes(key))
|
|
|
|
? adapter.auto
|
|
|
|
: adapter.static,
|
2023-05-11 16:30:21 +08:00
|
|
|
csp: {
|
|
|
|
directives: {
|
2024-09-11 18:29:31 +08:00
|
|
|
'style-src': ['self', 'unsafe-inline', 'https://giscus.app'],
|
|
|
|
},
|
|
|
|
mode: 'auto',
|
|
|
|
},
|
|
|
|
prerender: {
|
|
|
|
handleMissingId: 'warn',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
preprocess: [mdsvex(mdsvexConfig), vitePreprocess()],
|
2023-08-28 17:52:45 +08:00
|
|
|
}
|