Migrate to React/Vite & Sass
Some checks failed
Deploy Sokko G / deploy (push) Failing after 4s

This commit is contained in:
Shinuwa 2026-07-21 10:09:25 +02:00
parent db4b99aee3
commit 1dee8b528f
30 changed files with 3491 additions and 2444 deletions

View file

@ -3,8 +3,11 @@ import { createServer } from "node:http";
import { extname, join, relative, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const root = resolve(fileURLToPath(new URL(".", import.meta.url)), "website");
const publicRoot = join(root, "public");
const projectRoot = resolve(fileURLToPath(new URL(".", import.meta.url)));
const websiteRoot = join(projectRoot, "website");
const distRoot = join(websiteRoot, "dist");
const root = existsSync(distRoot) ? distRoot : websiteRoot;
const publicRoot = existsSync(distRoot) ? distRoot : join(websiteRoot, "public");
function loadEnvFile(file = ".env") {
if (!existsSync(file)) return;
@ -63,7 +66,7 @@ function resolvePath(url) {
const publicCandidate = fileIfReadable(resolve(publicRoot, `.${requested}`));
if (publicCandidate && isInsideRoot(publicRoot, publicCandidate)) return publicCandidate;
return join(publicRoot, "index.html");
return join(root, "index.html");
}
const server = createServer((req, res) => {