-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsvelte.config.js
80 lines (68 loc) · 1.82 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
import { mdsvex } from "mdsvex"
import mdsvexConfig from "./mdsvex.config.js"
import preprocess from "svelte-preprocess"
import { resolve } from "path"
import adapter from "@sveltejs/adapter-node"
import dotenv from "dotenv"
import dynamicImportVars from "@rollup/plugin-dynamic-import-vars"
await dotenv.config();
const prod = process.env["NODE_ENV"] === "production";
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: [".svelte", ...mdsvexConfig.extensions],
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: [preprocess(), mdsvex(mdsvexConfig)],
kit: {
adapter: adapter({
out: "build"
}),
alias: {
$assets: "./src/assets",
$content: './src/content',
$components: './src/components',
$models: './src/models',
$formElements: './src/components/forms/elements',
$brandIcons: './src/components/icons/brands'
},
vite: {
envPrefix: "CLIENT_",
plugins: [
// Source: https://github.com/sveltejs/kit/issues/3030
(function LoadSecrets() {
return {
name: "load-secrets",
configureServer: async () => {
;(await import('dotenv')).config()
}
}
})(),
dynamicImportVars({
include: [
"./src/lib/loadContents.js"
]
})
]
},
csp: {
/** @see hooks `src/hooks/index.ts` for additional directives */
directives: prod ? {
"default-src": ["none"],
"font-src": ["self"],
"img-src": ["self"],
"script-src": ["self", "https://umami.transdb.de"],
"style-src": ["self", "unsafe-inline"]
} : {}
}
},
onwarn: (warning, handler) => {
const { code, message } = warning;
if (code === "css-unused-selector") {
// ignores this warning
return;
} else {
handler(warning);
}
}
};
export default config;