Skip to content

Adopt tsdown for package builds - #293

Open
parthban-db wants to merge 1 commit into
mainfrom
parthban-db/stack/issue-267
Open

Adopt tsdown for package builds#293
parthban-db wants to merge 1 commit into
mainfrom
parthban-db/stack/issue-267

Conversation

@parthban-db

@parthban-db parthban-db commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🥞 Stacked PR

Use this link to review incremental changes.


Summary

Adopts tsdown as the shared ESM build tool for all 86 package workspaces while preserving the existing ES2024 target, unbundled package layout, declaration generation, and source maps. This PR is intentionally limited to adopting the bundler; it does not add CJS output, new package entry points, or source API changes.

Why

The published packages declare "type": "module", but the current tsc -b output retains extensionless relative imports. Node's native ESM resolver requires explicit extensions for relative specifiers, so affected entry points fail with ERR_MODULE_NOT_FOUND, as reported in #267 and documented in Node's mandatory file extensions. A shared bundler step emits Node-resolvable JavaScript without requiring a repository-wide rewrite of source imports and provides one build configuration for later artifact-focused follow-ups.

What changed

Interface changes

None. Package export maps and source-level public APIs are unchanged.

Behavioral changes

  • Emitted relative JavaScript imports include .js extensions, allowing affected package entry points to load through Node's native ESM resolver.
  • Source files that import package metadata now produce internal dist/package.js modules instead of retaining JSON imports in the emitted JavaScript.
  • Generated JavaScript, declarations, and source-map representation change because tsdown uses Rolldown and its declaration pipeline; public runtime and TypeScript export names remain unchanged in the validated Core and Postgres artifacts.

Internal changes

  • Adds pinned tsdown@0.20.3 development tooling and its lockfile entries.
  • Adds one root tsdown.config.ts configured for ESM, ES2024, neutral platform, unbundled and unminified output, external dependencies, unhashed filenames, TypeScript declaration generation, and source maps.
  • Changes the build script in all 86 package workspaces from tsc -b to tsdown.
  • Leaves package source files and TypeScript configuration unchanged.

How is this tested?

  • CI build, lint, type-check, Node test, browser test, and license jobs pass across Node.js 22 and 24.
  • Rebuilt and packed Core and Postgres from clean snapshots of main and this PR, then compared the extracted npm artifacts.
  • Verified native ESM imports improve from 1/11 to 11/11 Core public entry points and from 0/1 to 1/1 Postgres public entry points.
  • Verified the compared export surfaces remain unchanged: 28 runtime and 63 TypeScript exports for Core, and 49 runtime and 157 TypeScript exports for Postgres.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

@parthban-db
parthban-db marked this pull request as ready for review August 7, 2026 13:29
@parthban-db
parthban-db force-pushed the parthban-db/stack/issue-267 branch from 58218c2 to 0c9828b Compare August 7, 2026 13:33
@parthban-db parthban-db changed the title Adopt tsdown bundler Adopt tsdown for package builds Aug 9, 2026
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.

1 participant