Skip to content

Commit

Permalink
fix: add /api in pwa navigateFallbackDenylist
Browse files Browse the repository at this point in the history
  • Loading branch information
ourongxing committed Oct 24, 2024
1 parent 2e0f332 commit 6f05725
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import tsconfigPath from "vite-tsconfig-paths"
import unocss from "unocss/vite"
import dotenv from "dotenv"
import type { VitePWAOptions } from "vite-plugin-pwa"
// import { VitePWA } from "vite-plugin-pwa"
import { VitePWA } from "vite-plugin-pwa"
import { projectDir } from "./shared/dir"

dotenv.config({
path: join(projectDir, ".env.server"),
})

const _pwaOption: Partial<VitePWAOptions> = {
const pwaOption: Partial<VitePWAOptions> = {
includeAssets: ["icon.svg", "apple-touch-icon.png"],
manifest: {
name: "NewsNow",
Expand Down Expand Up @@ -47,6 +47,9 @@ const _pwaOption: Partial<VitePWAOptions> = {
},
],
},
workbox: {
navigateFallbackDenylist: [/^\/api/],
},
devOptions: {
enabled: process.env.SW_DEV === "true",
type: "module",
Expand Down Expand Up @@ -106,7 +109,7 @@ export default defineConfig({
}),
unocss(),
react(),
// VitePWA(pwaOption),
VitePWA(pwaOption),
nitro(nitroOption),
],
})

0 comments on commit 6f05725

Please sign in to comment.