Vite modifications for PWA

Changes to be committed:
	modified:   public/manifest.json
	modified:   public/serviceworker.js
	modified:   tsconfig.json
	renamed:    vite.config.js -> vite.config.ts
This commit is contained in:
matthieu42morin 2023-03-16 14:52:11 +01:00
parent 9ce38e2197
commit 2ebd7030eb
4 changed files with 12 additions and 4 deletions

View File

@ -6,6 +6,11 @@
"name": "Erant",
"orientation": "any",
"scope": "/",
"serviceworker": {
"src": "service-worker.js",
"scope": "/",
"use_cache": false
},
"short_name": "erant",
"start_url": "/",
"theme_color": "#ffffff",

View File

@ -1,9 +1,9 @@
// This is the service worker with the combined offline experience (Offline page + Offline copy of pages)
import { workbox } from 'https://storage.googleapis.com/workbox-cdn/releases/5.1.4/workbox-sw.js'
const CACHE = 'pwabuilder-offline-page'
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.4/workbox-sw.js')
// TODO: replace the following with the correct offline fallback page i.e.: const offlineFallbackPage = "offline.html";
const offlineFallbackPage = '/offline.html'

View File

@ -7,7 +7,7 @@
"isolatedModules": true,
"noEmit": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"paths": {
"$lib/*": ["./src/lib/*"],
"$root/*": ["./*"],

View File

@ -4,8 +4,11 @@ import preprocess from 'svelte-preprocess'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
/** @type {import('vite').UserConfig} */
export default {
// ...
resolve: {
alias: {
$lib: path.resolve(__dirname, 'src', 'lib'),
$root: path.resolve(__dirname),
@ -21,4 +24,4 @@ export default defineConfig({
})
})
]
})
}