From d5772940df1a61c475477374ed9565008610ef7e Mon Sep 17 00:00:00 2001 From: Exoridus Date: Sun, 5 Jul 2026 10:09:22 +0200 Subject: [PATCH] fix(build): stop emitting stray .d.ts trees from single-file bundle configs 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. --- rollup.config.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index d1e8f645..4e96c0bf 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -121,6 +121,14 @@ function basePlugins(options: { ]; } +// The root tsconfig inherits `declaration: true` (library profile). Only the +// `modules` build is meant to emit declarations (into dist/esm); every other +// config must switch them off, or @rollup/plugin-typescript emits the whole +// .d.ts tree as bundle assets — polluting dist/ with a duplicate declaration +// tree and inflating the Codecov bundle-analysis numbers (incompressible +// assets are counted at raw size in the gzip column). +const noDeclarations = { declaration: false, declarationMap: false } as const; + const bundled: RollupOptions = { input: 'src/index.ts', output: { @@ -132,7 +140,7 @@ const bundled: RollupOptions = { ...basePlugins({ exportConditions: sourceConditions, transform: typescript({ - compilerOptions: { incremental: false }, + compilerOptions: { incremental: false, ...noDeclarations }, outputToFilesystem: false, }), minify: 'production', @@ -153,7 +161,7 @@ const iife: RollupOptions = { plugins: basePlugins({ exportConditions: sourceConditions, transform: typescript({ - compilerOptions: { incremental: false }, + compilerOptions: { incremental: false, ...noDeclarations }, outputToFilesystem: false, }), }), @@ -172,7 +180,7 @@ const iifeMin: RollupOptions = { ...basePlugins({ exportConditions: sourceConditions, transform: typescript({ - compilerOptions: { incremental: false }, + compilerOptions: { incremental: false, ...noDeclarations }, outputToFilesystem: false, }), minify: 'always', @@ -197,7 +205,7 @@ const debugBundled: RollupOptions = { plugins: basePlugins({ exportConditions: sourceConditions, transform: typescript({ - compilerOptions: { incremental: false }, + compilerOptions: { incremental: false, ...noDeclarations }, outputToFilesystem: false, }), minify: 'production',