Repository navigation
Conversation
Fourteen runtime .mjs files that ship verbatim were also inlined into the bundled entries and chunks. tsdown now leaves them external, so the entries import the shipped file: one module instance and about 18 KB less packed.
This was referenced Nov 3, 2026
Closed
Closed
This branch has not been deployed
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.
Summary
Each runtime module now ships once, which takes about 18 KB packed and 63 KB unpacked off the package.
Why
The runtime
.mjsfiles undersrc/are copied intodistas-is, because Node loads them as files. Fourteen of them were also inlined into the bundled entries and chunks, so the package shipped their code twice and a process could hold two instances of each. Packed headroom was down to 3% against the 5% budget policy.Changes
tsdown.config.tsmarks every verbatim-copied.mjsas never bundled. The bundles now import the shipped file. One predicate decides both what is copied and what stays external.tests/verbatim-runtime-once.test.tsfails if a verbatim-shipped module is inlined into a bundle again, or if an emitted relative import does not resolve insidedist.Notes
helpers.cjsnow loadserrors.mjsthroughrequire(esm). Every Node version inenginessupports this, and 22.13.0 loads it without a warning.Symbol.for, and errors are checked by shape, notinstanceof.src/plugin.tsstill has its own versions ofpackageNameOf,subpathLeafOfandisUtilitySubpathfromnative/match.mjs. That source-level duplication is out of scope here.