Skip to content

Conversation

@overbalance
Copy link
Contributor

@overbalance overbalance commented Dec 8, 2025

Which problem is this PR solving?

Research for #4898

ESM builds don't work in Node.js or Deno due to:

  1. The module export condition is non-standard (bundler-only)
  2. ESM output lacks .js extensions required by Node.js

Short description of the changes

  • Migrate build from tsc to tsdown - Replaces multi-target tsc builds (CJS/ESM/ESNext) with tsdown bundler
  • Dual CJS/ESM output - Outputs .cjs and .mjs files with proper extensions
  • Fix exports field - Uses standard import/default conditions instead of module
  • Keep esnext condition - Points to .mjs for consumers wanting ES2022+ syntax
  • Preserve browser field - Maintains backwards compatibility for bundlers
  • Nx inferred tasks - Adds scripts/nx/tsdown-plugin.js for compile targets
  • ESLint CJS configs - Renames .eslintrc.js to .eslintrc.cjs for ESM compatibility

Export condition order: typesesnextimportdefault

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • npm run compile passes (44 packages)
  • npm run lint passes
  • ESM and CJS imports verified manually

Checklist:

  • Followed the style guidelines of this project
  • Changelog entries added
  • Documentation has been updated

@overbalance overbalance force-pushed the overbalance/fix/esm-exports-condition branch from 9784ca7 to e77327d Compare December 8, 2025 23:42
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.41%. Comparing base (0a1a631) to head (e77327d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6201   +/-   ##
=======================================
  Coverage   95.41%   95.41%           
=======================================
  Files         317      317           
  Lines        9460     9460           
  Branches     2199     2199           
=======================================
  Hits         9026     9026           
  Misses        434      434           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@overbalance overbalance force-pushed the overbalance/fix/esm-exports-condition branch 2 times, most recently from a213f80 to 47da788 Compare December 9, 2025 18:59
@overbalance overbalance changed the title fix(exports): replace non-standard module condition with import feat(build): migrate to tsdown bundler Dec 9, 2025
@overbalance overbalance force-pushed the overbalance/fix/esm-exports-condition branch from d42419e to b90f983 Compare December 9, 2025 20:49
@overbalance overbalance force-pushed the overbalance/fix/esm-exports-condition branch from be32ed5 to ebe8a02 Compare December 10, 2025 15:55
@overbalance
Copy link
Contributor Author

Interesting research but tsdown doesn't preserve barrel files so we would need to modify how node/browser entry files are constructed.

@overbalance overbalance changed the title feat(build): migrate to tsdown bundler research(build): migrate to tsdown bundler Dec 10, 2025
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