Skip to content

Commit e1b2e08

Browse files
authored
fix: externalize before caching (#9077)
1 parent 229b5b3 commit e1b2e08

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/vitest/src/node/cache/fsModuleCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class FileSystemModuleCache {
3434
private rootCache: string
3535
private metadataFilePath: string
3636

37-
private version = '1.0.0-beta.1'
37+
private version = '1.0.0-beta.2'
3838
private fsCacheRoots = new WeakMap<ResolvedConfig, string>()
3939
private fsEnvironmentHashMap = new WeakMap<DevEnvironment, string>()
4040
private fsCacheKeyGenerators = new Set<CacheKeyIdGenerator>()

packages/vitest/src/node/environments/fetchModule.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ class ModuleFetcher {
6666
return { cache: true }
6767
}
6868

69+
const externalize = await this.resolver.shouldExternalize(moduleGraphModule.id!)
70+
if (externalize) {
71+
return { externalize, type: 'module' }
72+
}
73+
6974
const cachePath = await this.getCachePath(
7075
environment,
7176
moduleGraphModule,
@@ -271,11 +276,6 @@ class ModuleFetcher {
271276
moduleGraphModule: EnvironmentModuleNode,
272277
options?: FetchFunctionOptions,
273278
): Promise<FetchResult> {
274-
const externalize = await this.resolver.shouldExternalize(moduleGraphModule.id!)
275-
if (externalize) {
276-
return { externalize, type: 'module' }
277-
}
278-
279279
const moduleRunnerModule = await fetchModule(
280280
environment,
281281
url,

0 commit comments

Comments
 (0)