mirror of
https://github.com/interstellar750/hexo_s
synced 2024-09-08 09:32:38 +08:00
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
// svelte adapter
|
|
import adapterAuto from '@sveltejs/adapter-auto'
|
|
import adapterNode from '@sveltejs/adapter-node'
|
|
import adapterStatic from '@sveltejs/adapter-static'
|
|
// svelte preprocessor
|
|
import { mdsvex } from 'mdsvex'
|
|
import mdsvexConfig from './mdsvex.config.js'
|
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
|
|
|
const adapter = {
|
|
auto: adapterAuto(),
|
|
node: adapterNode(),
|
|
static: adapterStatic({
|
|
pages: 'build',
|
|
assets: 'build',
|
|
fallback: undefined
|
|
})
|
|
}
|
|
|
|
/** @type {import("@svletejs/kit".Config)} */
|
|
export default {
|
|
extensions: ['.svelte', ...mdsvexConfig.extensions],
|
|
preprocess: [mdsvex(mdsvexConfig), vitePreprocess()],
|
|
kit: {
|
|
adapter:
|
|
process.env.ADAPTER
|
|
? adapter[process.env.ADAPTER.toLowerCase()]
|
|
: Object.keys(process.env).some(key => ['VERCEL', 'NETLIFY'].includes(key))
|
|
? adapter['auto']
|
|
: adapter['static'],
|
|
prerender: {
|
|
handleMissingId: 'warn'
|
|
},
|
|
csp: {
|
|
mode: 'auto',
|
|
directives: {
|
|
'style-src': ['self', 'unsafe-inline', 'https://giscus.app']
|
|
}
|
|
}
|
|
}
|
|
}
|