π¦ Trim npm package size (521 KB β 213 KB, no runtime change)#1206
Merged
Conversation
Shrinks the published `effection` npm package without touching the code consumers actually run. Three dnt build options in tasks/build-npm.ts: - `sourceMap: false` β stop shipping `.js.map` (no runtime value) - `declaration: "separate"` β emit `.d.ts` once into a shared `types/` folder instead of duplicating across `esm/` and `script/` - `skipSourceOutput: true` β stop shipping raw `src/*.ts` Measured (npm pack): - unpacked on disk: 521 KB -> 213 KB (-59%), 427 -> 145 files - download (.tgz): 80 KB -> 40 KB (-49%) - runtime bundle (min+gzip): 5.8 KB, unchanged The 5.8 KB a bundler pulls into an app was already optimal; the old 580 KB was install-only dev artifacts (sourcemaps, per-module dup'd declarations, raw TS source) that no app bundle loads. Verified ESM import, CJS require, and `tsc` type resolution all still pass. Works on the currently pinned dnt 0.41.3 β no toolchain bump required.
commit: |
cowboyd
approved these changes
Jul 5, 2026
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.
Motivation
pkg-size.dev/effectionreports the published package at ~580 KB, which looks alarming. On inspection almost all of it is install-only dev artifacts, not code that lands in a consumer's app bundle β the runtime cost a bundler actually pulls in was already optimal at ~5.8 KB min+gzip. The tarball was ~30% sourcemaps, ~20% duplicated.d.ts(emitted into bothesm/andscript/), and ~18% raw TS source β none of which a bundler loads. This PR trims that fat without touching the code consumers run.Approach
Three dnt build options in
tasks/build-npm.ts:sourceMap: false.js.map(no runtime value)declaration: "separate".d.tsonce into a sharedtypes/folder instead of duplicating acrossesm/andscript/skipSourceOutput: truesrc/*.tsWorks on the currently pinned dnt 0.41.3 β no toolchain bump required.
Measured (via
npm pack).tgzgzip)Verified
import { run, sleep } from "effection"runsrequire("effection")runs (CJS output preserved)tsc --noEmitresolves types against the new sharedtypes/folderNotes / decisions
deno bundle --declaration(the "bundled single.d.ts" idea) was evaluated and rejected: it can't type-check effection's cross-runtimelib/main.ts(usesDeno.*, DOM, and anode:processdynamic import at once β no singlelibsatisfies all three), and pre-bundling gave no runtime-size win since bundlers already tree-shake the modular output.sourceMap: falseis the one debatable line β it drops the biggest chunk (157 KB) but also removes published debugging maps. If shipping sourcemaps is preferred, revert just that line (unpacked lands at ~370 KB instead of 213 KB).