-
Notifications
You must be signed in to change notification settings - Fork 3
/
svelte.config.js
41 lines (37 loc) · 1.22 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 { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import mdsvexConfig from './mdsvex.config.mjs'
import adapter from '@sveltejs/adapter-auto'
import { mdsvex } from 'mdsvex'
import { createShikiLogger, processCodeblockSync, getOrLoadOpts } from '@samplekit/preprocess-shiki'
const opts = await getOrLoadOpts()
const preprocessorRoot = `${import.meta.dirname}/src/routes/`
const formatFilename = (/** @type {string} */ filename) => filename.replace(preprocessorRoot, '')
const ignoreWarnings = ['element_invalid_self_closing_tag']
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte', ...mdsvexConfig.extensions],
preprocess: [
processCodeblockSync({
include: (filename) => filename.startsWith(preprocessorRoot),
logger: createShikiLogger(formatFilename),
opts,
}),
vitePreprocess({ script: true }),
mdsvex(mdsvexConfig),
],
kit: { adapter: adapter() },
vitePlugin: {
inspector: {
toggleButtonPos: 'bottom-left',
toggleKeyCombo: 'meta-alt-control',
},
},
onwarn: (warning, handler) => {
if (ignoreWarnings.includes(warning.code)) return
handler(warning)
},
warningFilter: (warning) => {
return !ignoreWarnings.includes(warning.code)
},
}
export default config