Bundle analysis: `normalizePath` replaces everything after the first `-` in a file name, so different assets collide
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, node.js
- Domain
- backend
Research direction
Start by inspecting normalizePath in @codecov/bundler-plugin-core and the tests for its Vite filename patterns. Reproduce the collision with the two maplibre paths in the issue, then check that normalization preserves the full asset name before the hash. Done means those paths normalize distinctly and unchanged assets no longer produce false size changes.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- No language data
- Stars
- 52
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from codecov/feedback
-
Docs Waiting for: Product Owner
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Feature RequestOpen
Difficulty 5/5 Over a week Newbie friendliness 5/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 54/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 8/100
All issues in codecov/feedback
Similar issues
-
BUG: catalog database credentials printed to logs at startupPossibly taken @cjboyle claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
backend bug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
geolens-io/geolens#3639 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/maven-enforcer#1074 ·
Maintainers usually reply within 1 day
-
bug libcudf
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days