Skip to content

Commit c3370ce

Browse files
authored
Merge pull request #122 from traPtitech/chore/sync-buster-with-version
buster が常に package.json の version を参照するように
2 parents 19a5de8 + db4b623 commit c3370ce

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/lib/queryClient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
declare const __APP_VERSION__: string
12
import { QueryClient } from '@tanstack/vue-query'
23
import { persistQueryClient } from '@tanstack/query-persist-client-core'
34
import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister'
@@ -21,5 +22,5 @@ persistQueryClient({
2122
queryClient,
2223
persister: asyncPersister,
2324
maxAge: 7 * 24 * 60 * 60 * 1000, // 永続化キャッシュの寿命
24-
buster: 'v1', // APIやスキーマが変わったら更新
25+
buster: __APP_VERSION__, // package.json のバージョンを自動反映
2526
})

vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pkg from './package.json'
12
import { fileURLToPath, URL } from 'node:url'
23

34
import { defineConfig } from 'vite'
@@ -8,6 +9,9 @@ import { VitePWA } from 'vite-plugin-pwa'
89

910
export default defineConfig(({ mode }) => {
1011
return {
12+
define: {
13+
__APP_VERSION__: JSON.stringify(pkg.version),
14+
},
1115
plugins: [
1216
vue(),
1317
vueDevTools(),

0 commit comments

Comments
 (0)