This commit is contained in:
seb
2026-07-31 08:34:51 +02:00
parent a95b7f4b1e
commit 797ea59bed
24 changed files with 1151 additions and 130 deletions

View File

@@ -96,7 +96,7 @@ const sharedServer = {
},
};
export default defineConfig({
export default defineConfig(({ command }) => ({
build: {
rolldownOptions: {
output: {
@@ -117,42 +117,48 @@ export default defineConfig({
},
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
manifest: {
id: '/',
name: 'Dashfront',
short_name: 'Dashfront',
start_url: '/',
scope: '/',
display: 'standalone',
background_color: '#dceeea',
theme_color: '#3b5bdb',
icons: [
{
src: '/icons/icon-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: '/icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,webmanifest,woff2}'],
navigateFallback: 'index.html',
},
}),
...(command === 'build'
? [
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
manifest: {
id: '/',
name: 'Dashfront',
short_name: 'Dashfront',
start_url: '/',
scope: '/',
display: 'standalone',
background_color: '#dceeea',
theme_color: '#3b5bdb',
icons: [
{
src: '/icons/icon-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: '/icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,webmanifest,woff2}'],
navigateFallback: 'index.html',
navigateFallbackDenylist: [/^\/api/],
},
}),
]
: []),
],
server: sharedServer,
preview: sharedServer,
});
}));