drawdb/vite.config.js
Felix Zedén Yverås 22a7603c21 fix: minor PWA fixes and implement offline support
Minor fixes such as setting the start_url to `/editor`. Also add
complete offline support by updating configuration.

This is especially nice for mobile users.

I've had some slight issues running this via `npm run dev`.
However, `npm run build && npm run preview` seems to work fine.
2024-07-12 22:47:58 +02:00

56 lines
1.4 KiB
JavaScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
VitePWA({
workbox: {
globPatterns: ["**/*"],
maximumFileSizeToCacheInBytes: 15_000_000,
},
includeAssets: ["**/*"],
registerType: "prompt",
manifest: {
name: "DrawDB",
short_name: "DrawDB",
icons: [
{
src: "/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: "/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
{
src: "/pwa-maskable-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "maskable",
},
{
src: "/pwa-maskable-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
scope: "/",
start_url: "/editor",
display: "standalone",
background_color: "#14475b",
theme_color: "#14475b",
description:
"Free, simple, and intuitive database design tool and SQL generator.",
},
}),
],
});