Add Progressive Web App (PWA) support

Add PWA setup with vite-plugin-pwa, assets generator, and templates
Include CLI flag and interactive prompt option for PWA installation
This commit is contained in:
Aman Varshney
2025-03-22 13:05:45 +05:30
parent 9c53d77965
commit 66a47c7c61
11 changed files with 102 additions and 13 deletions

View File

@@ -19,3 +19,5 @@ dist/
*.env*
!.env.example
dev-dist

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,12 @@
import {
defineConfig,
minimal2023Preset as preset,
} from "@vite-pwa/assets-generator/config";
export default defineConfig({
headLinkOptions: {
preset: "2023",
},
preset,
images: ["public/logo.png"],
});

View File

@@ -0,0 +1,35 @@
import tailwindcss from "@tailwindcss/vite";
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
export default defineConfig({
plugins: [
tailwindcss(),
TanStackRouterVite({}),
react(),
VitePWA({
registerType: "autoUpdate",
manifest: {
name: "My App",
short_name: "My App ",
description: "My App",
theme_color: "#0c0c0c",
},
pwaAssets: {
disabled: false,
config: true,
},
devOptions: {
enabled: true,
},
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});