Skip to content

Commit cd86d47

Browse files
knight.chenkeuby
authored andcommitted
fix(mfsu.eager): escape question mark in file extension regex to prevent incorrect replacements
1 parent 7228d99 commit cd86d47

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/preset-umi/src/libs/folderCache/LazySourceCodeCache.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ export class LazySourceCodeCache {
188188
for (const f of files) {
189189
let newFile = join(this.cachePath, relative(this.srcPath, f));
190190

191-
newFile = newFile.replace(new RegExp(`${extname(newFile)}$`), '.js');
191+
const extRegexStr = extname(newFile).replace(/[.?]/g, '\\$&');
192+
newFile = newFile.replace(new RegExp(`${extRegexStr}$`), '.js');
192193

193194
loaded[f] = readFileSync(newFile, 'utf-8');
194195
}

0 commit comments

Comments
 (0)