File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -158,25 +158,24 @@ export async function setupCache(nuxt: Nuxt) {
158
158
storage : {
159
159
cache : {
160
160
driver,
161
- binding : 'CACHE'
161
+ binding : 'CACHE' ,
162
+ base : 'cache'
162
163
}
163
164
} ,
164
165
devStorage : {
165
- cache : {
166
- driver,
167
- binding : 'CACHE'
168
- }
166
+ cache : nuxt . options . dev
167
+ // if local development, use KV binding so it respect TTL
168
+ ? {
169
+ driver,
170
+ binding : 'CACHE'
171
+ }
172
+ : {
173
+ // Used for pre-rendering
174
+ driver : 'fs' ,
175
+ base : join ( nuxt . options . rootDir , '.data/cache' )
176
+ }
169
177
}
170
178
} )
171
- nuxt . hooks . hook ( 'nitro:init' , ( nitro ) => {
172
- nitro . hooks . hook ( 'prerender:config' , ( config ) => {
173
- config . devStorage ||= { }
174
- config . devStorage . cache = {
175
- driver : 'fs' ,
176
- base : join ( nuxt . options . rootDir , '.data/cache' )
177
- }
178
- } )
179
- } )
180
179
181
180
// Add Server scanning
182
181
addServerScanDir ( resolve ( './runtime/cache/server' ) )
You can’t perform that action at this time.
0 commit comments