Skip to content

Commit a4dc76c

Browse files
Luke MurrayJounQin
Luke Murray
authored andcommitted
fix: check if cwd changed to bust mapper cache
1 parent 2671757 commit a4dc76c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: src/index.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ let previousOptionsHash: string
119119
let optionsHash: string
120120
let cachedOptions: InternalResolverOptions | undefined
121121

122+
let prevCwd: string
123+
122124
let mappersCachedOptions: InternalResolverOptions
123125
let mappers: Array<((specifier: string) => string[]) | null> | undefined
124126

@@ -347,9 +349,14 @@ function getMappedPath(
347349
}
348350

349351
function initMappers(options: InternalResolverOptions) {
350-
if (mappers && mappersCachedOptions === options) {
352+
if (
353+
mappers &&
354+
mappersCachedOptions === options &&
355+
prevCwd === process.cwd()
356+
) {
351357
return
352358
}
359+
prevCwd = process.cwd()
353360

354361
const configPaths =
355362
typeof options.project === 'string'

0 commit comments

Comments
 (0)