Gjør PWA-stier relative for fleksibel utrulling
Appen kan nå serveres både på / og under en understi som /tilfluktsrom uten endringer. - Sett base: './' i vite.config.ts - Endre alle absolutte stier i index.html til relative - Oppdater manifest.webmanifest med start_url: "." og scope: "." - navigateFallback uten ledende skråstrek Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8e6dbb6b24
commit
85c3d6953c
3 changed files with 10 additions and 8 deletions
|
|
@ -8,9 +8,9 @@
|
||||||
<meta http-equiv="Content-Security-Policy"
|
<meta http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://*.tile.openstreetmap.org; connect-src 'self' https://*.tile.openstreetmap.org; font-src 'self'; worker-src 'self'" />
|
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://*.tile.openstreetmap.org; connect-src 'self' https://*.tile.openstreetmap.org; font-src 'self'; worker-src 'self'" />
|
||||||
<title>Tilfluktsrom</title>
|
<title>Tilfluktsrom</title>
|
||||||
<link rel="manifest" href="/manifest.webmanifest" />
|
<link rel="manifest" href="manifest.webmanifest" />
|
||||||
<link rel="icon" type="image/png" sizes="192x192" href="/icons/icon-192.png" />
|
<link rel="icon" type="image/png" sizes="192x192" href="icons/icon-192.png" />
|
||||||
<link rel="apple-touch-icon" href="/icons/icon-192.png" />
|
<link rel="apple-touch-icon" href="icons/icon-192.png" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
|
@ -63,6 +63,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,21 @@
|
||||||
"name": "Tilfluktsrom",
|
"name": "Tilfluktsrom",
|
||||||
"short_name": "Tilfluktsrom",
|
"short_name": "Tilfluktsrom",
|
||||||
"description": "Find the nearest public shelter in Norway",
|
"description": "Find the nearest public shelter in Norway",
|
||||||
"start_url": "/",
|
"start_url": ".",
|
||||||
|
"scope": ".",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"theme_color": "#1A1A2E",
|
"theme_color": "#1A1A2E",
|
||||||
"background_color": "#1A1A2E",
|
"background_color": "#1A1A2E",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/icons/icon-192.png",
|
"src": "icons/icon-192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/icons/icon-512.png",
|
"src": "icons/icon-512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
|
||||||
import { VitePWA } from 'vite-plugin-pwa';
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
base: './',
|
||||||
define: {
|
define: {
|
||||||
// Injected as a global — changes every build, breaking any stale cache
|
// Injected as a global — changes every build, breaking any stale cache
|
||||||
__BUILD_REVISION__: JSON.stringify(
|
__BUILD_REVISION__: JSON.stringify(
|
||||||
|
|
@ -21,7 +22,7 @@ export default defineConfig({
|
||||||
cleanupOutdatedCaches: true,
|
cleanupOutdatedCaches: true,
|
||||||
|
|
||||||
// SPA: serve index.html for all navigation requests
|
// SPA: serve index.html for all navigation requests
|
||||||
navigateFallback: '/index.html',
|
navigateFallback: 'index.html',
|
||||||
|
|
||||||
// Vite already hashes JS/CSS filenames — skip Workbox's
|
// Vite already hashes JS/CSS filenames — skip Workbox's
|
||||||
// cache-bust query parameter for those
|
// cache-bust query parameter for those
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue