-
Notifications
You must be signed in to change notification settings - Fork 3
/
svelte.config.js
75 lines (64 loc) · 1.71 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
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"
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"
}),
vite: {
resolve: {
alias: {
$assets: resolve("./src/assets"),
$content: resolve('./src/content'),
$components: resolve('./src/components'),
$models: resolve('./src/models'),
$formElements: resolve('./src/components/forms/elements'),
$brandIcons: resolve('./src/components/icons/brands')
},
},
envPrefix: "CLIENT_",
plugins: [
// Source: https://github.com/sveltejs/kit/issues/3030
(function LoadSecrets() {
return {
name: "load-secrets",
configureServer: async () => {
;(await import('dotenv')).config()
}
}
})()
]
},
csp: {
/** @see hooks `src/hooks/index.ts` for additional directives */
directives: prod ? {
"default-src": ["none"],
"font-src": ["self"],
"img-src": ["self"],
"script-src": ["self"],
"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;