First working prototype
This commit is contained in:
@@ -1,33 +1,53 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
||||
import { defineConfig } from 'vite';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
server: {
|
||||
host: '0.0.0.0'
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
plugins: [
|
||||
svelte(),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
// Never `autoUpdate`: a worker swap mid-day reloads the page under the
|
||||
// user's hands. The app decides when to apply an update (see
|
||||
// src/lib/updates.svelte.js) and only offers it while no day is running.
|
||||
registerType: 'prompt',
|
||||
pwaAssets: {
|
||||
image: 'public/icon.svg',
|
||||
},
|
||||
manifest: {
|
||||
name: 'TimeLog PWA',
|
||||
name: 'TimeLog — suivi des heures',
|
||||
short_name: 'TimeLog',
|
||||
theme_color: '#ffffff',
|
||||
icons: [
|
||||
{
|
||||
src: 'pwa-192x192.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png'
|
||||
},
|
||||
{
|
||||
src: 'pwa-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
description:
|
||||
"Suivi des heures de chantier hors ligne, avec récapitulatif de la dernière journée.",
|
||||
lang: 'fr',
|
||||
dir: 'ltr',
|
||||
start_url: '/',
|
||||
scope: '/',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait',
|
||||
background_color: '#ffffff',
|
||||
theme_color: '#0047b3',
|
||||
categories: ['productivity', 'utilities'],
|
||||
},
|
||||
workbox: {
|
||||
// The whole app is a handful of files; precache it all so a cold start
|
||||
// offline is identical to a warm one.
|
||||
//
|
||||
// `webmanifest` is deliberately NOT in this list: the plugin injects its
|
||||
// own manifest entry, and a glob that also matches it produces two
|
||||
// precache entries for the same URL with different revisions. Workbox
|
||||
// rejects conflicting entries, the install handler throws, and nothing
|
||||
// gets cached at all — the app silently stops working offline.
|
||||
globPatterns: ['**/*.{js,css,html,svg,png,ico}'],
|
||||
cleanupOutdatedCaches: true,
|
||||
clientsClaim: false,
|
||||
},
|
||||
}),
|
||||
],
|
||||
})
|
||||
test: {
|
||||
include: ['src/**/*.test.js'],
|
||||
environment: 'node',
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user