-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsvelte.config.js
More file actions
54 lines (49 loc) · 1.44 KB
/
svelte.config.js
File metadata and controls
54 lines (49 loc) · 1.44 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
import { createShikiLogger, processCodeblockSync, getOrLoadOpts } from '@samplekit/preprocess-shiki'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import mdsvexConfig from './mdsvex.config.mjs'
import adapter from '@sveltejs/adapter-auto'
import { mdsvex } from 'mdsvex'
const opts = await getOrLoadOpts()
const preprocessorRoot = `${import.meta.dirname}/src/routes/`
const formatFilename = (/** @type {string} */ filename) => filename.replace(preprocessorRoot, '')
const svelte_ignores = [
'element_invalid_self_closing_tag',
'no_static_element_interactions',
'a11y_click_events_have_key_events',
]
/** @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(),
// prerender: {
// handleHttpError: ({ path, message }) => {
// if (path === '/404') return
// throw new Error(message)
// },
// },
},
vitePlugin: {
inspector: {
toggleButtonPos: 'bottom-left',
toggleKeyCombo: 'meta-alt-control',
},
},
onwarn: (warning, handler) => {
if (svelte_ignores.includes(warning.code)) return
handler(warning)
},
warningFilter: warning => {
return !svelte_ignores.includes(warning.code)
},
}
export default config