fix(build): stop emitting stray .d.ts trees from single-file bundle configs#260
Open
Exoridus wants to merge 1 commit into
Open
fix(build): stop emitting stray .d.ts trees from single-file bundle configs#260Exoridus wants to merge 1 commit into
Exoridus wants to merge 1 commit into
Conversation
…onfigs The root tsconfig inherits declaration:true from the library profile, so the four single-file rollup configs (exo-esm, iife, iife-min, debug) each emitted the full declaration tree as bundle assets: a duplicate .d.ts tree in dist/ (316 files, never published) and wildly inflated Codecov bundle-analysis numbers. Codecov counts incompressible assets at raw size in the gzip column, so exo-iife-min reported 1.58MB total / 1.06MB gzip while the real bundle is 695kB / 174kB. Only the modules build is meant to emit declarations (dist/esm); all other configs now set declaration:false explicitly. Verified: stray .d.ts count 316 -> 0, dist/esm keeps 316, size-limit + verify:exports + production-stripping all green.
Bundle ReportChanges will decrease total bundle size by 1.78MB (-7.41%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: exo-iife-min-Exo-iifeAssets Changed:
view changes for bundle: exo-esm-esmAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Codecov's Bundles tab reported nonsense for the single-file bundles:
exo-iife-minshowed 1.58MB total / 1.06MB gzip while the real file is 695kB / 174kB — the gzip figure was larger than the correctly-reported unminified full bundle (438kB).Root cause
The root tsconfig inherits
declaration: truefrom the shared library profile. The four single-file rollup configs (exo-esm,iife,iife-min,debug) never overrode it, so@rollup/plugin-typescriptemitted the entire declaration tree as bundle assets in each of those builds:.d.tstree written intodist/(never published —fileswhitelists onlydist/esm/+ the bundles — but wasted build work),.d.tsassets counted into the Codecov bundle stats. The Codecov plugin only gzipscss|html|json|js|svg|txt|xml|xhtml, so incompressible assets land in the gzip column at raw size: 174,070 (js gzip) + 887,897 (d.ts raw) = 1,061,967 = the reported 1.06MB, byte-exact (per-asset breakdown pulled via the Codecov GraphQL API).exo-full-iifelooked correct because it uses the esbuild transform (no typescript plugin, no declarations).exo-esmwas equally affected (reported 1.58MB/1.06MB, real 688kB/172kB).Fix
Only the
modulesbuild is meant to emit declarations (intodist/esm); every other config now setsdeclaration: false, declarationMap: falseexplicitly.Verification
.d.tsoutsidedist/esm: 316 → 0;dist/esmkeeps its 316pnpm sizegreen (real numbers: esm 172.32kB, iife-min 175.24kB gzip)pnpm verify:exportsgreen (10 targets)