From: Ruben Beltran del Rio Date: Sun, 29 Aug 2021 20:20:01 +0000 (+0200) Subject: Prepare for deploy X-Git-Url: https://git.r.bdr.sh/rbdr/prompt/commitdiff_plain/0931cb4c8774df6d270e0af33e572438a162ae18?hp=38431710cfb1cc1ffd7297085d069be1328f083b Prepare for deploy --- diff --git a/src/lib/stores/prompt.js b/src/lib/stores/prompt.js index 59df711..7559657 100644 --- a/src/lib/stores/prompt.js +++ b/src/lib/stores/prompt.js @@ -2,14 +2,15 @@ import { readable } from 'svelte/store'; import { browser } from '$app/env'; const internals = { - kDataPrefix: 'http://localhost:3000/data/', + kHost: import.meta.env.VITE_PUBLIC_BASE_PATH || 'http://localhost:3000', + kDataPrefix: '/data/', kAdjectivesPath: '/adjectives.json', kNounsPath: '/nouns.json', async get(locale, path) { const shortLocale = locale.split('-')[0]; - const targetFile = internals.kDataPrefix + shortLocale + path; + const targetFile = internals.kHost + internals.kDataPrefix + shortLocale + path; const data = browser && sessionStorage.getItem(targetFile); if (data) { diff --git a/svelte.config.js b/svelte.config.js index eec59a1..1652cf6 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -2,9 +2,11 @@ import adapter from '@sveltejs/adapter-static'; /** @type {import('@sveltejs/kit').Config} */ const config = { - adapter: adapter(), kit: { // hydrate the
element in src/app.html + adapter: adapter({ + fallback: 'index.html' + }), target: '#svelte' } };