Skip to content

chore: replace tsup bundle with plain tsc emit - #50

Merged
dopry merged 2 commits into
nextfrom
claude/rebase-esm-chore-dko2vv
Jul 21, 2026
Merged

chore: replace tsup bundle with plain tsc emit#50
dopry merged 2 commits into
nextfrom
claude/rebase-esm-chore-dko2vv

Conversation

@dopry

@dopry dopry commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Follow-up to #24. Now that the package is ESM-only, the reasons tsup was adopted in Phase 3 (dual CJS+ESM output, bundled .d.ts rollup) no longer apply — so this removes the bundler instead of maintaining it.

Changes

  • Build: npm run build now runs tsc -p tsconfig.build.json (new config extending tsconfig.json with noEmit: false, outDir: dist, rootDir: src). dist/ mirrors src/ with per-module .js / .d.ts / .js.map instead of a single bundle.
  • Removed: tsup devDependency and tsup.config.ts.
  • Unchanged for consumers: entry points stay dist/index.js / dist/index.d.ts, so main, types, and the exports map are untouched, and the exports map continues to block deep imports into internals. Docker (node dist/index.js) unchanged.
  • Test: esm-package.spec.ts builds via tsc (shell-free, cross-platform) and still verifies the built package loads under real Node ESM through the exports map with no empty side-effect imports — now checking every emitted module rather than one bundle.

Why

  • The emitting compiler is the same one that typechecks (nodenext + verbatimModuleSyntax), so the published output can never drift from what tsc verified — and the declaration rollup step (historically the fragile part of bundler-based library builds) is gone.
  • Mirrored dist makes future subpath exports (@dopry/pecans/backends, …) a one-line exports addition.
  • Consumer stack traces point at real module files; one less toolchain in devDependencies.

Verified: lint, prettier, typecheck, full vitest suite (771 tests), node dist/index.js server start, and a real-Node import('@dopry/pecans') smoke test.

🤖 Generated with Claude Code

https://claude.ai/code/session_017zXcPSv6FFTPgD59T4KudM


Generated by Claude Code

Now that the package is ESM-only, the reasons tsup was adopted (dual
CJS+ESM output, bundled .d.ts) no longer apply, so drop the bundler:

- build with tsc -p tsconfig.build.json; dist/ mirrors src/ with
  per-module .js/.d.ts/.js.map instead of a single bundle
- the emitting compiler is the same one that typechecks, so build
  output can never drift from what tsc verified
- public entry points are unchanged (dist/index.js, dist/index.d.ts);
  the exports map still blocks deep imports, so consumers see no
  difference
- esm-package.spec.ts builds via tsc and still verifies the built
  package under real Node ESM
- remove tsup from devDependencies and drop tsup.config.ts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017zXcPSv6FFTPgD59T4KudM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the tsup bundling step and switches the package build to a plain TypeScript compiler emit (tsc -p tsconfig.build.json), producing a dist/ tree that mirrors src/ for the ESM-only package.

Changes:

  • Replace the tsup build with tsc using a dedicated tsconfig.build.json.
  • Remove tsup configuration and dependency.
  • Update the ESM package integration test to build with tsc directly and validate emitted modules.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsup.config.ts Removes the tsup bundler configuration.
tsconfig.json Stops including the removed tsup.config.ts in the main TS project.
tsconfig.build.json Adds a build-specific TS config to emit dist/ from src/.
test/integration/esm-package.spec.ts Builds via tsc and validates emitted ESM output under real Node.
package.json Updates build script to run tsc (but currently has an eval bug).
package-lock.json Removes tsup and its dependency tree from the lockfile.
.github/copilot-instructions.md Updates contributor instructions to reflect the new build.

Comment thread package.json Outdated
The predefined-builtins behavior of node --eval is documented and the
previous form worked, but the explicit require reads unambiguously.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017zXcPSv6FFTPgD59T4KudM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated no new comments.

@dopry
dopry merged commit 581cefa into next Jul 21, 2026
3 checks passed
@dopry
dopry deleted the claude/rebase-esm-chore-dko2vv branch July 21, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants