File tree 1 file changed +7
-11
lines changed
packages/vite/src/node/optimizer
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import type { ResolvedConfig } from '../config'
13
13
import {
14
14
arraify ,
15
15
createDebugger ,
16
- emptyDir ,
17
16
flattenId ,
18
17
getHash ,
19
18
isOptimizable ,
@@ -328,6 +327,8 @@ export function addOptimizedDepInfo(
328
327
return depInfo
329
328
}
330
329
330
+ let firstLoadCachedDepOptimizationMetadata = true
331
+
331
332
/**
332
333
* Creates the initial dep optimization metadata, loading it from the deps cache
333
334
* if it exists and pre-bundling isn't forced
@@ -340,16 +341,11 @@ export async function loadCachedDepOptimizationMetadata(
340
341
) : Promise < DepOptimizationMetadata | undefined > {
341
342
const log = asCommand ? config . logger . info : debug
342
343
343
- setTimeout ( ( ) => {
344
- // Before Vite 2.9, dependencies were cached in the root of the cacheDir
345
- // For compat, we remove the cache if we find the old structure
346
- if ( fs . existsSync ( path . join ( config . cacheDir , '_metadata.json' ) ) ) {
347
- emptyDir ( config . cacheDir )
348
- }
349
- // Fire a clean up of stale cache dirs, in case old processes didn't
350
- // terminate correctly
351
- cleanupDepsCacheStaleDirs ( config )
352
- } , 100 )
344
+ if ( firstLoadCachedDepOptimizationMetadata ) {
345
+ firstLoadCachedDepOptimizationMetadata = false
346
+ // Fire up a clean up of stale processing deps dirs if older process exited early
347
+ setTimeout ( ( ) => cleanupDepsCacheStaleDirs ( config ) , 0 )
348
+ }
353
349
354
350
const depsCacheDir = getDepsCacheDir ( config , ssr )
355
351
You can’t perform that action at this time.
0 commit comments