Bundle analysis: `normalizePath` replaces everything after the first `-` in a file name, so different assets collide
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js
- 领域
- backend
调研方向
先检查 @codecov/bundler-plugin-core 中的 normalizePath 以及针对其 Vite 文件名模式的测试。使用 issue 中的两个 maplibre 路径重现冲突,然后检查规范化是否保留了哈希前的完整 asset 名称。当这些路径规范化后的结果互不相同,且未更改的 asset 不再产生虚假的大小变化时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
normalizePath in @codecov/bundler-plugin-core replaces everything from the first - in a file name up to the extension with *, not only the hash. If two assets share the text before their first -, they get the same normalized path, and the bundle comparison matches the wrong files against each other.
On https://github.com/kristof-mattei/endless-ssh-rs-with-web/pull/3817#issuecomment-6641294034 (the rows are in the comment's edit history), the bundle report contained these two rows:
| Asset Name | Size Change | Total Size | Change (%) |
|---|---|---|---|
assets/maplibre-*.js |
-517.19kB | 1.85kB | -99.64% |
assets/maplibre-*.js |
517.19kB | 519.04kB | 27926.19% ⚠️ |
Both rows come from two unchanged files matched against each other: maplibre-gl-worker-Br3j0JGE.js (519.04 kB) and maplibre-gl-AxBTEyzg.js (1.85 kB). The size changes cancel out exactly. The bundle totals in the same comment are correct.
Environment
@codecov/vite-plugin2.0.1 and@codecov/bundler-plugin-core2.0.1 (the latest release of both)- Vite 8.3.5 with Rolldown 1.2.16, default
chunkFileNamesandassetFileNames - CI on GitHub Actions. Reproduced locally on Node.js 26.13.0
To Reproduce
import { normalizePath } from "@codecov/bundler-plugin-core";
normalizePath("assets/maplibre-gl-AxBTEyzg.js", "assets/[name]-[hash].js", "vite");
// "assets/maplibre-*.js"
normalizePath("assets/maplibre-gl-worker-Br3j0JGE.js", "assets/[name]-[hash][extname]", "vite");
// "assets/maplibre-*.js"
normalizePath("assets/preload-helper-BRbzi6Nc.js", "assets/[name]-[hash].js", "vite");
// "assets/preload-*.js"
Expected behavior
normalizePath replaces only the hash: assets/maplibre-gl-*.js, assets/maplibre-gl-worker-*.js, assets/preload-helper-*.js. If an asset is unchanged, the bundle report lists no size change for it.
Additional context
None at the moment
- 主要语言
- 没有语言数据
- 星标
- 52
- 派生
- 26
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codecov/feedback 的其他 Issue
-
Docs Waiting for: Product Owner
难度 1/5 1 小时以内 新手友好度 65/100
-
Feature Request未关闭
难度 5/5 一周以上 新手友好度 5/100
-
难度 2/5 1-3 小时 新手友好度 54/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 8/100
相似的 Issue
-
BUG: catalog database credentials printed to logs at startup可能已有人在做 @cjboyle 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
backend bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 78/100
geolens-io/geolens#3639 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
apache/maven-enforcer#1074 ·
维护者通常 1 天内回复
-
bug libcudf
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复