Conversation
07eb638 to
ced0d5c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
tsdown's DepPlugin externalizes any package listed in package.json dependencies by default. For a SEA binary every dependency must be bundled into the single output file, so override this with deps.alwaysBundle: () => true. The previous deps.skipNodeModulesBundle: false was a no-op — that flag only controls automatic externalization of node_modules that are NOT production deps, and was already false by default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ESM SEA binaries load ~7x slower than CJS due to async module graph initialization (compileSourceTextModule). The old esbuild script used format: cjs explicitly; tsdown defaults to esm. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The original esbuild script used minify: true. Smaller bundle means less to parse and load at startup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Startup Performance AnalysisBenchmarked against the current Homebrew release (built with esbuild):
Root cause: rolldown does not implement scope hoisting for CJS output. esbuild merges all modules into a single flat scope — the old bundle has 4 module wrappers. rolldown wraps every module in a lazy closure, giving our bundle 568 closures that must be allocated and invoked at startup. Both bundles use CJS format and minification, so the gap is entirely due to rolldown's module wrapping overhead. Options considered
The migration to tsdown's |
|
The build in main is working fine, so there's no reason to switch to tsdown for the SEA build right now. Closing this for now. |
tsdown 0.21 added support for SEA, so this switches from esbuilt to the latest tsdown.
Closes #254