Skip to content

Commit

Permalink
chore: make cache time more obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Feb 22, 2024
1 parent 9f19d53 commit c0a1d3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function setupPublicAssetStrategy (options: ModuleOptions['assets'] = {})
nuxt.options.routeRules ||= {}
nuxt.options.routeRules[joinURL(assetsBaseURL, '**')] = {
cache: {
maxAge: 60 * 60 * 24 * 365,
maxAge: ONE_YEAR_IN_SECONDS,
}
}
}
Expand All @@ -80,7 +80,7 @@ export function setupPublicAssetStrategy (options: ModuleOptions['assets'] = {})
nuxt.options.nitro = defu(nuxt.options.nitro, {
publicAssets: [{
dir: cacheDir,
maxAge: 31536000 /* 1 year */,
maxAge: ONE_YEAR_IN_SECONDS,
baseURL: assetsBaseURL
}],
prerender: {
Expand Down Expand Up @@ -117,3 +117,5 @@ export function setupPublicAssetStrategy (options: ModuleOptions['assets'] = {})

return { normalizeFontData }
}

const ONE_YEAR_IN_SECONDS = 60 * 60 * 24 * 365

0 comments on commit c0a1d3d

Please sign in to comment.