build: rm tsx, use --experimental-transform-types#6007
Closed
Conversation
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
69de4cb to
385db87
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
1 similar comment
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Merge activity
|
graphite-app bot
pushed a commit
that referenced
this pull request
Feb 1, 2026
### TL;DR Migrate codebase to use native TypeScript ESM imports with import.meta.dirname instead of __dirname ### What changed? - Replaced `__dirname` with `import.meta.dirname` throughout the codebase - Updated import statements to use ESM-compatible syntax - Changed `* as module` imports to default imports where appropriate - Replaced `require.main === module` checks with `import.meta.filename === process.argv[1]` - Added proper type annotations for dynamic imports - Removed dependency on `tsx` package - Updated Node.js options to use `--experimental-transform-types` instead of tsx - Added `rewriteRelativeImportExtensions: true` to tsconfig ### How to test? 1. Run the test suite to ensure all functionality works as expected 2. Verify that scripts can be executed directly with Node.js using the `--experimental-transform-types` flag 3. Check that all imports resolve correctly in both development and production environments ### Why make this change? This change modernizes the codebase to use native ESM features in TypeScript, improving compatibility with the Node.js ESM loader. By removing the dependency on the `tsx` package and using Node.js's built-in TypeScript support via the `--experimental-transform-types` flag, the project reduces external dependencies and aligns with modern JavaScript practices. This approach provides better long-term maintainability and prepares the codebase for future Node.js versions where ESM is the standard module system.
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.

TL;DR
Migrate codebase to use native TypeScript ESM imports with import.meta.dirname instead of __dirname
What changed?
__dirnamewithimport.meta.dirnamethroughout the codebase* as moduleimports to default imports where appropriaterequire.main === modulechecks withimport.meta.filename === process.argv[1]tsxpackage--experimental-transform-typesinstead of tsxrewriteRelativeImportExtensions: trueto tsconfigHow to test?
--experimental-transform-typesflagWhy make this change?
This change modernizes the codebase to use native ESM features in TypeScript, improving compatibility with the Node.js ESM loader. By removing the dependency on the
tsxpackage and using Node.js's built-in TypeScript support via the--experimental-transform-typesflag, the project reduces external dependencies and aligns with modern JavaScript practices. This approach provides better long-term maintainability and prepares the codebase for future Node.js versions where ESM is the standard module system.