feat: update Vite PWA configuration for improved caching and asset management

This commit is contained in:
2026-01-06 22:41:04 +07:00
parent e4e4d50ca8
commit f8c77ad93e
6 changed files with 746 additions and 6 deletions

View File

@@ -1,3 +1,3 @@
VITE_API_URL=http://192.168.1.6:9528 VITE_API_URL=http://192.168.1.6:9528
VITE_TRADINGVIEW_LIBRARY_URL=http://192.168.1.4:6173 VITE_TRADINGVIEW_LIBRARY_URL=https://dev.riwsan1.com
# VITE_TRADINGVIEW_DATA_API_URL=https://demo-feed-data.tradingview.com # VITE_TRADINGVIEW_DATA_API_URL=https://demo-feed-data.tradingview.com

View File

@@ -1,3 +1,3 @@
VITE_API_URL=http://192.168.1.6:9527 VITE_API_URL=http://192.168.1.6:9527
VITE_TRADINGVIEW_LIBRARY_URL=http://192.168.1.4:6173 VITE_TRADINGVIEW_LIBRARY_URL=https://dev.riwsan1.com
# VITE_TRADINGVIEW_DATA_API_URL=https://demo-feed-data.tradingview.com # VITE_TRADINGVIEW_DATA_API_URL=https://demo-feed-data.tradingview.com

1
.gitignore vendored
View File

@@ -26,6 +26,7 @@ npm-debug.log*
!/.vscode/extensions.json !/.vscode/extensions.json
/coverage /coverage
/dist /dist
/dev-dist
/node_modules /node_modules
/platforms /platforms
/plugins /plugins

View File

@@ -11,6 +11,7 @@
"run:ios": "ionic capacitor run ios -l --external", "run:ios": "ionic capacitor run ios -l --external",
"run:android": "ionic capacitor run android -l --external", "run:android": "ionic capacitor run android -l --external",
"proxy": "ionic config set -g proxy http://192.168.1.3:9527", "proxy": "ionic config set -g proxy http://192.168.1.3:9527",
"deploy:cloudflare": "wrangler pages deploy dist --project-name=riwa --branch=main",
"test:e2e": "cypress run", "test:e2e": "cypress run",
"test:unit": "vitest", "test:unit": "vitest",
"lint": "eslint", "lint": "eslint",
@@ -93,7 +94,9 @@
"vite": "^7.2.7", "vite": "^7.2.7",
"vite-plugin-pwa": "^1.2.0", "vite-plugin-pwa": "^1.2.0",
"vitest": "^4.0.15", "vitest": "^4.0.15",
"vue-tsc": "^3.1.8" "vue-tsc": "^3.1.8",
"workbox-window": "^7.4.0",
"wrangler": "^4.54.0"
}, },
"simple-git-hooks": { "simple-git-hooks": {
"pre-commit": "pnpm lint-staged" "pre-commit": "pnpm lint-staged"

727
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -42,7 +42,12 @@ export default defineConfig({
}), }),
VitePWA({ VitePWA({
registerType: "autoUpdate", registerType: "autoUpdate",
includeAssets: ["favicon.svg", "apple-touch-icon.png"], injectRegister: "auto",
includeAssets: ["favicon.svg"],
devOptions: {
enabled: true,
type: "module",
},
manifest: { manifest: {
name: "Riwa", name: "Riwa",
short_name: "Riwa", short_name: "Riwa",
@@ -58,8 +63,9 @@ export default defineConfig({
icons: [ icons: [
{ {
src: "/favicon.svg", src: "/favicon.svg",
sizes: "192x192", sizes: "any",
type: "image/svg", type: "image/svg+xml",
purpose: "any maskable",
}, },
], ],
}, },
@@ -67,6 +73,9 @@ export default defineConfig({
globPatterns: ["**/*.{js,css,html,ico,png,svg,woff2}"], globPatterns: ["**/*.{js,css,html,ico,png,svg,woff2}"],
navigateFallback: "/index.html", navigateFallback: "/index.html",
navigateFallbackDenylist: [/^\/api/], navigateFallbackDenylist: [/^\/api/],
cleanupOutdatedCaches: true,
clientsClaim: true,
skipWaiting: true,
}, },
}), }),
generateVersion({ generateVersion({