fix(web): PWA asset and route handling (#898)

* fix(web): PWA asset and fallback route handling

* fix(web): strip baseurl

* fix(web): add back manifest.json

* fix(web): add back manifest.json

* fix(web): log file

* fix(web): do not trim baseurl

* fix(web): try different start_url

* fix(web): pwa with subfolder
This commit is contained in:
ze0s 2023-05-02 19:06:53 +02:00 committed by GitHub
parent d085d894d4
commit 319bc2f200
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 110 additions and 30 deletions

View file

@ -13,12 +13,16 @@ export default ({ mode }: { mode: any }) => {
base: "",
plugins: [react(), VitePWA({
registerType: "autoUpdate",
injectRegister: "auto",
injectRegister: "inline",
scope: "{{.BaseUrl}}",
// strategies: "injectManifest",
useCredentials: true,
includeAssets: [
"favicon.svg",
"favicon.ico",
"robots.txt",
"apple-touch-icon.png",
"logo.png",
"apple-touch-icon-*.png",
"manifest.webmanifest",
"assets/**/*"
],
@ -29,6 +33,11 @@ export default ({ mode }: { mode: any }) => {
theme_color: "#141415",
background_color: "#141415",
icons: [
{
src: "logo.png",
sizes: "192x192",
type: "image/png"
},
{
src: "logo192.png",
sizes: "192x192",
@ -39,17 +48,21 @@ export default ({ mode }: { mode: any }) => {
sizes: "512x512",
type: "image/png"
},
{
src: "logo512.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable"
},
{
src: "apple-touch-icon-iphone-retina-120x120.png",
sizes: "120x120",
type: "image/png"
}
],
start_url: "/",
start_url: "{{.BaseUrl}}",
scope: "{{.BaseUrl}}",
display: "standalone"
},
workbox: {
globPatterns: ["**/*.{js,css,html,svg}"],