Skip to content

refactor: make dist/ ESM - #250

Merged
af merged 1 commit into
af:mainfrom
slagiewka:esm
Sep 20, 2026
Merged

af merged 1 commit into
af:mainfrom
slagiewka:esm

Conversation

@slagiewka

Copy link
Copy Markdown
Contributor

Hey, I saw you're modernising the setup and that there's likely another major coming up.

If this interests you, the following changes make the output dist/ ESM. For node.js users, it will require 20.19+ (package.json currently specifies engine >= 18).

Comment thread tsconfig.json
"module": "nodenext",
"moduleResolution": "nodenext",
"rewriteRelativeImportExtensions": true,
"erasableSyntaxOnly": true,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This isn't strictly necessary and can be removed. However, my experience shows that it's beneficial to use it unless enums are required. It ensures that the emitted code stays as close as possible to the source.

It also makes it extremely easy to enable node's type stripping. Since this project's development is mostly running tests and vitest has no issues running TS anyway, it's not a direct benefit. Should you want to drop vitest, however, it's way easier then 😉

@af

af commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Thanks! I have to admit that I'm one of those people with an irrational hatred of file extensions in imports 😂 so while this is a nice modernization, I'll need to think about it and get over it before merging

@af
af merged commit 847a62d into af:main Sep 20, 2026
5 checks passed
@af

af commented Sep 20, 2026

Copy link
Copy Markdown
Owner

I finally convinced myself :) Bumped the min version of node to 22 (since 20 and below are EOL). Thanks for taking the lead on this!

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.

2 participants