Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

svelte.config.js 1.2 KB

You have to be logged in to leave a comment. Sign In
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
  1. import adapter from "@sveltejs/adapter-node";
  2. import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
  3. import dotenv from "dotenv";
  4. import { execSync } from "child_process";
  5. dotenv.config({ path: "./.env.local" });
  6. dotenv.config({ path: "./.env" });
  7. function getCurrentCommitSHA() {
  8. try {
  9. return execSync("git rev-parse HEAD").toString();
  10. } catch (error) {
  11. console.error("Error getting current commit SHA:", error);
  12. return "unknown";
  13. }
  14. }
  15. process.env.PUBLIC_VERSION ??= process.env.npm_package_version;
  16. process.env.PUBLIC_COMMIT_SHA ??= getCurrentCommitSHA();
  17. /** @type {import('@sveltejs/kit').Config} */
  18. const config = {
  19. // Consult https://kit.svelte.dev/docs/integrations#preprocessors
  20. // for more information about preprocessors
  21. preprocess: vitePreprocess(),
  22. kit: {
  23. adapter: adapter(),
  24. paths: {
  25. base: process.env.APP_BASE || "",
  26. relative: false,
  27. },
  28. csrf: {
  29. // handled in hooks.server.ts, because we can have multiple valid origins
  30. checkOrigin: false,
  31. },
  32. csp: {
  33. directives: {
  34. ...(process.env.ALLOW_IFRAME === "true" ? {} : { "frame-ancestors": ["'none'"] }),
  35. },
  36. },
  37. alias: {
  38. $api: "./src/lib/server/api",
  39. "$api/*": "./src/lib/server/api/*",
  40. },
  41. },
  42. };
  43. export default config;
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...