-
-
Notifications
You must be signed in to change notification settings - Fork 231
Open
Description

The above image is the basic setup i did and i just updated my vite.config.ts
to this below,
Basically i added prefix path so my base url is http://localhost:4173/mobile
The problem is, When I am not using the base url and when I reload page I get the reload prompt like the picture below , But when i am using baseUrl and I do not get the reload prompt, It's updated directly without any prompt. and after I manually press update button on the top right
and reload the page i get the prompt saying App ready to work offline

import { VitePWA } from "vite-plugin-pwa";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
const PATH_PREFIX = "mobile";
// https://vitejs.dev/config/
export default defineConfig({
base: `/${PATH_PREFIX}`,
plugins: [
react(),
VitePWA({
strategies: "injectManifest",
srcDir: "src",
filename: "sw.ts",
registerType: "prompt",
injectRegister: false,
manifest: {
name: "pwa-inject-manifest-prompt",
short_name: "pwa-inject-manifest-prompt",
description: "pwa-inject-manifest-prompt",
theme_color: "#ffffff",
icons: [
{
src: "pwa-64x64.png",
sizes: "64x64",
type: "image/png",
},
{
src: "pwa-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "pwa-512x512.png",
sizes: "512x512",
type: "image/png",
},
{
src: "maskable-icon-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
workbox: {
cleanupOutdatedCaches: true,
},
injectManifest: {
globPatterns: ["**/*.{js,css,html,svg,png,ico}"],
},
devOptions: {
enabled: true,
navigateFallback: "index.html",
suppressWarnings: true,
type: "module",
},
}),
],
});
Metadata
Metadata
Assignees
Labels
No labels