-
Notifications
You must be signed in to change notification settings - Fork 12
/
svelte.config.js
54 lines (46 loc) · 1.27 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
42
43
44
45
46
47
48
49
50
51
52
53
54
import adapter from '@sveltejs/adapter-static'
import { mdsvex } from 'mdsvex'
import mdsvexamples from 'mdsvexamples'
import katex from 'rehype-katex-svelte'
import math from 'remark-math'
import preprocess from 'svelte-preprocess'
const { default: pkg } = await import(`./package.json`, {
with: { type: `json` },
})
const defaults = {
Wrapper: `svelte-zoo/CodeExample.svelte`,
pkg: pkg.name,
repo: pkg.repository,
hideStyle: true,
}
const remarkPlugins = [[mdsvexamples, { defaults }], math]
const rehypePlugins = [katex]
/** @type {import('@sveltejs/kit').Config} */
export default {
extensions: [`.svelte`, `.svx`, `.md`],
preprocess: [
preprocess(),
mdsvex({ remarkPlugins, rehypePlugins, extensions: [`.svx`, `.md`] }),
],
compilerOptions: {
// enable direct prop access for vitest unit tests
accessors: process.env.TEST,
},
kit: {
adapter: adapter({ fallback: `404.html` }),
alias: {
$root: `.`,
$types: `src/types`,
$site: `src/site`,
$static: `static`,
},
prerender: {
handleHttpError: ({ path, message }) => {
// ignore missing element photos
if (path.startsWith(`/elements/`)) return
// fail the build for other errors
throw new Error(message)
},
},
},
}