-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathsvelte.config.js
100 lines (90 loc) · 2.92 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import "dotenv/config";
import adapter from "@sveltejs/adapter-static";
import { mdsvex } from "mdsvex";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";
import { sveltePreprocess } from "svelte-preprocess";
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
extensions: [".svelte", ".md"],
preprocess: [
{
name: "strip-announcer",
markup: ({ content: code }) => {
code = code.replace(
/<div id="svelte-announcer" [\s\S]*?<\/div>/,
'<svelte:component this={null} />'
);
return { code }
}
},
sveltePreprocess(),
mdsvex({
extensions: ['.md'],
layout: {
about: join(
dirname(fileURLToPath(import.meta.url)),
'/src/components/misc/AboutPageWrapper.svelte'
),
changelogs: join(
dirname(fileURLToPath(import.meta.url)),
'/src/components/changelog/ChangelogEntryWrapper.svelte'
)
}
})
],
kit: {
adapter: adapter({
// default options are shown. On some platforms
// these options are set automatically — see below
pages: 'build',
assets: 'build',
fallback: '404.html',
precompress: false,
strict: true
}),
csp: {
mode: "hash",
directives: {
"connect-src": ["*"],
"default-src": ["none"],
"font-src": ["self"],
"style-src": ["self", "unsafe-inline"],
"img-src": ["*", "data:"],
"manifest-src": ["self"],
"worker-src": ["self"],
"object-src": ["none"],
"frame-src": [
"self",
"challenges.cloudflare.com"
],
"script-src": [
"self",
"wasm-unsafe-eval",
"challenges.cloudflare.com",
// eslint-disable-next-line no-undef
process.env.WEB_PLAUSIBLE_HOST ? process.env.WEB_PLAUSIBLE_HOST : "",
// hash of the theme preloader in app.html
"sha256-g67gIjM3G8yMbjbxyc3QUoVsKhdxgcQzCmSKXiZZo6s=",
],
"frame-ancestors": ["none"]
}
},
env: {
publicPrefix: 'WEB_'
},
version: {
pollInterval: 60000
},
paths: {
relative: false
},
alias: {
$components: 'src/components',
$i18n: 'i18n',
}
}
};
export default config;