SvelteKit plugin is broken (treats every build as a new app)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- performance, tooling
Research direction
Start at packages/sveltekit-plugin/src/sveltekit-bundle-analysis/sveltekitBundleAnalysisPlugin.ts, especially lines 24-29 linked in the report, and inspect how the bundle name is assembled. Compare the behavior with the provided workaround and verify that repeated builds produce stable bundle names without duplicate false size changes.
Written by the indexing model from the issue text.
Description
It seems like the version number/hash it added to the bundle name, causing every build to be treated as a different app. For example, this is how the bundle report looks like for any one of my PRs, regardless of the changes:
| Bundle name | Previous size | New size | Change |
|---|---|---|---|
| todo-boards-__sveltekit_1uzgg2h.app-client-esm | 0B | 3.26MB | +3.26MB |
| todo-boards-__sveltekit_1uzgg2h.app-server-esm | 0B | 2.85MB | +2.85MB |
| todo-boards-__sveltekit_rjtutb.app-client-esm | 3.25MB | 3.25MB | 0B |
| todo-boards-__sveltekit_rjtutb.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_md9ml7.app-client-esm | 3.25MB | 3.25MB | 0B |
| todo-boards-__sveltekit_md9ml7.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_rw61bm.app-client-esm | 3.25MB | 3.25MB | 0B |
| todo-boards-__sveltekit_rw61bm.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_oc9q2g.app-client-esm | 3.25MB | 3.25MB | 0B |
| todo-boards-__sveltekit_oc9q2g.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_pd0dha.app-client-esm | 3.25MB | 3.25MB | 0B |
| todo-boards-__sveltekit_pd0dha.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_9048ew.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_9048ew.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_jb7hj3.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_jb7hj3.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_15434l3.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_15434l3.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_wbgdw4.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_wbgdw4.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_1ul4wew.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_3mgeqa.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_3mgeqa.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_10ypcbc.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_10ypcbc.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_1xcvy2i.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_1xcvy2i.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_v9cwmu.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_v9cwmu.app-server-esm | 2.85MB | 2.85MB | 0B |
| todo-boards-__sveltekit_znjpv5.app-client-esm | 3.26MB | 3.26MB | 0B |
| todo-boards-__sveltekit_znjpv5.app-server-esm | 2.85MB | 2.85MB | 0B |
This then gets incorrectly reported as a large change, even though it isn't:
It seems like this is the code at fault:
here, options.name is __sveltekit_1uzgg2h.app, changing on every build.
Workaround
Patch (can be applied for example using yarn patch):
diff --git a/dist/index.mjs b/dist/index.mjs
index af4d577bb316858597a9f420574129e0e799684f..6dfaaedd4fddf5a4edd5e2fbc49bb1485913943f 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -31,7 +31,6 @@ const sveltekitBundleAnalysisPlugin = ({
output.originalBundleName,
options.dir,
options.format,
- options.name
);
output.unlockBundleName();
output.setBundleName(name);
- Dominant language
- TypeScript
- Stars
- 9
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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/codecov-javascript-bundler-plugins
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
-
Bundle stats upload fails against AWS S3 storage (chunked Transfer-Encoding → 501 NotImplemented)Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Support vite v7Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
codecov/codecov-javascript-bundler-plugins#264 · 9 comments · 37 reactions ·
All issues in codecov/codecov-javascript-bundler-plugins
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
wardian-app/Wardian#1603 ·
Maintainers usually reply within 1 day
-
Sign the pledgeOpen
Difficulty 1/5 Under an hour Newbie friendliness 85/100
input-output-hk/devx-updates#168 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/docs#46222 · 1 comment ·
Maintainers usually reply within 1 day
-
agent-ready area: config area: skills type: chore upstream: brain-kit
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
dev experience frontend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cuttle-cards/cuttle#1403 ·
Maintainers usually reply within 1 day