Skip to content

Commit 0cf161e

Browse files
committed
fix(builder): prevent repeated hash on pure-digit hash segments
looksAlreadyHashed required both letters and digits in the hash segment, so pure-digit hashes like 67058905 (valid sha256 prefix) were not recognized, causing infinite hash stacking on repeated builds (style.67058905.67058905...css → ENAMETOOLONG). Now also accepts 8+ hex-only segments (0-9a-f) as valid hashes.
1 parent 6e2ef36 commit 0cf161e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/plugin-builder/src/static-assets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function looksAlreadyHashed(filename: string): boolean {
3434
const m = HASHED_NAME_RE.exec(filename);
3535
if (!m) return false;
3636
const seg = m[2];
37-
// 必须同时含字母和数字,避免把 `style-12345678.css` 这种数字版本号误判
38-
return /[A-Za-z]/.test(seg) && /\d/.test(seg);
37+
// 8+ 位且由 hex 字符组成即视为 hash(含纯数字情况如 67058905)
38+
return /^[A-Fa-f0-9]{8,}$/.test(seg) || (/[A-Za-z]/.test(seg) && /\d/.test(seg));
3939
}
4040

4141
/**

0 commit comments

Comments
 (0)