trying again with old service worker

This commit is contained in:
adueck 2024-08-15 09:27:23 -04:00
parent 22827ae690
commit 719f646e14
3 changed files with 78 additions and 2047 deletions

View File

@ -61,7 +61,7 @@
"dev": "vite", "dev": "vite",
"lint": "eslint .", "lint": "eslint .",
"test": "jest", "test": "jest",
"build": "rm -rf dist && tsc -b && vite build && bun build src/service-worker.ts --outdir ./dist", "build": "rm -rf dist && tsc -b && vite build",
"preview": "vite preview", "preview": "vite preview",
"test-ci": "yarn test --watchAll=false" "test-ci": "yarn test --watchAll=false"
}, },

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,83 @@
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [
react(),
VitePWA({
strategies: "injectManifest",
srcDir: "src",
// using old service worker from create-react-app version
filename: "service-worker.ts",
manifestFilename: "manifest.json",
manifest: {
short_name: "Pashto Dictionary",
name: "LingDocs Pashto Dictionary",
id: "/",
icons: [
{
src: "/icons/android-chrome-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "/icons/android-chrome-512x512.png",
sizes: "512x512",
type: "image/png",
},
{
src: "/icons/maskable_icon_x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
{
src: "/icons/maskable_icon_x1024.png",
sizes: "1024x1024",
type: "image/png",
purpose: "maskable",
},
{
src: "/icons/android-chrome-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
],
display: "standalone",
theme_color: "#596267",
background_color: "#f9f9f9",
start_url: ".",
description:
"An offline Pashto Dictionary app with audio, approximate search-as-you-type, alphabetical browsing, verb conjugation, inflections, and a phrase generation engine.",
launch_handler: {
client_mode: "auto",
},
categories: [
"education",
"language",
"productivity",
"language learning",
"Pashto",
"dictionaries",
],
lang: "en",
prefer_related_applications: false,
share_target: {
action: "/share-target",
method: "GET",
params: {
title: "title",
text: "text",
url: "url",
},
},
},
}),
],
build: {
sourcemap: false,
},
}); });