website/app/vite.config.js

37 lines
902 B
JavaScript
Raw Normal View History

2025-01-04 19:59:44 +03:00
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
2025-01-07 00:13:11 +03:00
import { fileURLToPath } from "url";
import { readFileSync } from "fs";
const default_env = {
REPORT_URL: "https://github.com/ngn13/website/issues",
SOURCE_URL: "https://github.com/ngn13/website",
APP_URL: "http://localhost:7001",
API_URL: "http://localhost:7002",
DOC_URL: "http://localhost:7003",
};
2025-01-07 00:13:11 +03:00
const file = fileURLToPath(new URL("package.json", import.meta.url));
const json = readFileSync(file, "utf8");
const pkg = JSON.parse(json);
2023-08-20 00:57:35 +03:00
for (let env in default_env) {
if (process.env["WEBSITE_" + env] === undefined) process.env["WEBSITE_" + env] = default_env[env];
}
2023-08-20 00:57:35 +03:00
export default defineConfig({
2025-01-04 19:59:44 +03:00
plugins: [sveltekit()],
envPrefix: "WEBSITE",
preview: {
port: 7001,
strictPort: true,
},
server: {
port: 7001,
strictPort: true,
},
2025-01-07 00:13:11 +03:00
define: {
pkg: pkg,
},
2023-08-20 00:57:35 +03:00
});