mirror of
https://github.com/tiennm99/loto.git
synced 2026-10-13 22:16:07 +00:00
- Remove vietnamese-number.js + test: build-time Python script (generate-audio.py) is the sole spec for pre-baked MP3s; runtime no longer reads the JS module. - Remove resetMaster() export: only ever called from tests; inline the two-line body at test sites. - Update Python docstring to drop the JS-mirror reference. - Rewrite stale "CF Pages root" comment in svelte.config.js.
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import adapter from "@sveltejs/adapter-static";
|
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
import { loadEnv } from "vite";
|
|
|
|
const profile = process.env.BUILD_PROFILE;
|
|
const isCodeserver = process.env.VITE_DEV_PROFILE === "codeserver";
|
|
|
|
// Same env-loading concern as vite.config.js — .env.local isn't in
|
|
// process.env at config-eval time. loadEnv reads it.
|
|
const env = loadEnv(process.env.NODE_ENV ?? "development", process.cwd(), "");
|
|
|
|
// basePath resolution:
|
|
// 1. NEXT_BASE_PATH — explicit override (escape hatch)
|
|
// 2. codeserver dev → /absproxy/{port}
|
|
// 3. BUILD_PROFILE=gh → /loto
|
|
// 4. default (local dev / generic static host) → ""
|
|
function resolveBase() {
|
|
if (process.env.NEXT_BASE_PATH != null) return process.env.NEXT_BASE_PATH;
|
|
if (isCodeserver) {
|
|
const port = env.CODESERVER_PORT ?? "3000";
|
|
return `/absproxy/${port}`;
|
|
}
|
|
if (profile === "gh") return "/loto";
|
|
return "";
|
|
}
|
|
|
|
export default {
|
|
preprocess: vitePreprocess(),
|
|
kit: {
|
|
adapter: adapter({
|
|
pages: "build",
|
|
assets: "build",
|
|
fallback: undefined,
|
|
precompress: false,
|
|
strict: true,
|
|
}),
|
|
paths: { base: resolveBase() },
|
|
},
|
|
};
|