load in optimization and error correction
This commit is contained in:
+1
-20
@@ -13,9 +13,6 @@ export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const dataMode = (env.VITE_TASGRID_DATA_MODE || 'prod').toLowerCase()
|
||||
const isDevData = dataMode === 'dev'
|
||||
const pocketbaseUrl = env.VITE_POCKETBASE_URL || 'https://pocketbase.ccllc.pro'
|
||||
const pocketbaseOrigin = new URL(pocketbaseUrl).origin.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
const cacheSuffix = isDevData ? '-devdata' : '-prod'
|
||||
|
||||
return {
|
||||
define: {
|
||||
@@ -58,23 +55,7 @@ export default defineConfig(({ mode }) => {
|
||||
workbox: {
|
||||
cleanupOutdatedCaches: true,
|
||||
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: new RegExp(`^${pocketbaseOrigin}/api/.*`, 'i'),
|
||||
method: 'GET',
|
||||
handler: 'NetworkFirst',
|
||||
options: {
|
||||
cacheName: `api-cache${cacheSuffix}`,
|
||||
expiration: {
|
||||
maxEntries: 100,
|
||||
maxAgeSeconds: 60 * 60 * 24 * 7
|
||||
},
|
||||
cacheableResponse: {
|
||||
statuses: [0, 200]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
runtimeCaching: []
|
||||
}
|
||||
})
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user