mirror of
https://github.com/tiennm99/loto.git
synced 2026-10-15 08:17:07 +00:00
build(web): upgrade to SvelteKit 3 and adapter-static 4, move the PWA to vite-plugin-pwa
This commit is contained in:
1 parent
28825b78e4
commit
124d65f800
22 files changed
+310
-217
No files matched your search
+12
-7
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* SvelteKit `paths.base` resolution, shared between `svelte.config.js`
|
||||
* (page routing / prerendering) and `vite.config.js` (PWA precache
|
||||
* manifest). Both consumers MUST agree on the base or the service
|
||||
* worker's `additionalManifestEntries` end up origin-rooted while the
|
||||
* app itself serves under a sub-path (e.g. GitHub Pages `/loto`),
|
||||
* SvelteKit `paths.base` resolution, shared between the `sveltekit()`
|
||||
* plugin options (page routing / prerendering) and the PWA precache
|
||||
* manifest, both in `vite.config.js`. Both consumers MUST agree on the
|
||||
* base or the service worker's `additionalManifestEntries` end up
|
||||
* origin-rooted while the app itself serves under a sub-path (e.g. GitHub Pages `/loto`),
|
||||
* causing every precached URL to 404 and the SW install to fail.
|
||||
*
|
||||
* Resolution order:
|
||||
@@ -16,9 +16,14 @@
|
||||
*/
|
||||
import { loadEnv } from "vite";
|
||||
|
||||
/** @returns {string} */
|
||||
/**
|
||||
* SvelteKit validates the shape (leading `/`, no trailing `/`) when it loads
|
||||
* its config, so a malformed NEXT_BASE_PATH fails the build there.
|
||||
* @returns {"" | `/${string}`}
|
||||
*/
|
||||
export function resolveBase() {
|
||||
if (process.env.NEXT_BASE_PATH != null) return process.env.NEXT_BASE_PATH;
|
||||
if (process.env.NEXT_BASE_PATH != null)
|
||||
return /** @type {"" | `/${string}`} */ (process.env.NEXT_BASE_PATH);
|
||||
if (process.env.VITE_DEV_PROFILE === "codeserver") {
|
||||
// .env.local lives outside process.env at config-eval time; loadEnv reads it.
|
||||
const env = loadEnv(
|
||||
|
||||
Reference in new issue
Block a user