2026-10-03 13:33:50 +02:00
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
2026-10-03 14:29:28 +02:00
|
|
|
import basicSsl from '@vitejs/plugin-basic-ssl';
|
2026-10-03 13:33:50 +02:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
base: './',
|
|
|
|
|
plugins: [
|
|
|
|
|
react(),
|
2026-10-03 14:29:28 +02:00
|
|
|
// HTTPS=1 pnpm preview:https -> phones need a secure context for motion sensors and GPS
|
|
|
|
|
...(process.env.HTTPS ? [basicSsl()] : []),
|
2026-10-03 13:33:50 +02:00
|
|
|
VitePWA({
|
|
|
|
|
registerType: 'autoUpdate',
|
|
|
|
|
includeAssets: ['uswds/sprite.svg', 'icons/*.png', 'icons/*.svg'],
|
|
|
|
|
manifest: {
|
|
|
|
|
name: 'Kraków bez barier',
|
|
|
|
|
short_name: 'Bez barier',
|
|
|
|
|
description:
|
|
|
|
|
'Sprawdź dostępność miejsc i tras w Krakowie dla osób na wózkach i rodziców z wózkami dziecięcymi.',
|
|
|
|
|
lang: 'pl',
|
|
|
|
|
start_url: './',
|
|
|
|
|
scope: './',
|
|
|
|
|
display: 'standalone',
|
|
|
|
|
background_color: '#ffffff',
|
|
|
|
|
theme_color: '#1b1b1b',
|
|
|
|
|
icons: [
|
|
|
|
|
{ src: 'icons/icon-192.png', sizes: '192x192', type: 'image/png' },
|
|
|
|
|
{ src: 'icons/icon-512.png', sizes: '512x512', type: 'image/png' },
|
|
|
|
|
{ src: 'icons/icon-maskable-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
workbox: {
|
|
|
|
|
globPatterns: ['**/*.{js,mjs,css,html,svg,png,json,woff2}'],
|
|
|
|
|
maximumFileSizeToCacheInBytes: 6 * 1024 * 1024,
|
|
|
|
|
navigateFallback: 'index.html',
|
|
|
|
|
runtimeCaching: [
|
2026-10-03 14:29:28 +02:00
|
|
|
{
|
|
|
|
|
urlPattern: /^https:\/\/server\.arcgisonline\.com\/.*/,
|
|
|
|
|
handler: 'CacheFirst',
|
|
|
|
|
options: {
|
|
|
|
|
cacheName: 'sat-tiles',
|
|
|
|
|
expiration: { maxEntries: 400, maxAgeSeconds: 60 * 60 * 24 * 14 },
|
|
|
|
|
cacheableResponse: { statuses: [0, 200] },
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-10-03 13:33:50 +02:00
|
|
|
{
|
|
|
|
|
urlPattern: /^https:\/\/[abc]\.tile\.openstreetmap\.org\/.*/,
|
|
|
|
|
handler: 'CacheFirst',
|
|
|
|
|
options: {
|
|
|
|
|
cacheName: 'osm-tiles',
|
|
|
|
|
expiration: { maxEntries: 600, maxAgeSeconds: 60 * 60 * 24 * 14 },
|
|
|
|
|
cacheableResponse: { statuses: [0, 200] },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
css: {
|
|
|
|
|
preprocessorOptions: {
|
|
|
|
|
scss: {
|
|
|
|
|
loadPaths: ['node_modules/@uswds/uswds/packages'],
|
|
|
|
|
quietDeps: true,
|
|
|
|
|
silenceDeprecations: ['import', 'mixed-decls', 'global-builtin', 'color-functions'],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
test: { environment: 'node', include: ['src/**/*.test.ts'] },
|
|
|
|
|
});
|