Skip to content

feat: switch to ESM-only and import attributes#471

Open
43081j wants to merge 1 commit intomainfrom
esm-only
Open

feat: switch to ESM-only and import attributes#471
43081j wants to merge 1 commit intomainfrom
esm-only

Conversation

@43081j
Copy link
Contributor

@43081j 43081j commented Mar 22, 2026

This switches to ESM only, which means:

  • We drop tshy and just use TypeScript directly
  • Use import attributes (i.e. import the JSON directly using import)

This does mean we require a newer Node, one that can require(esm) and
use import attributes (specifically JSON).

🔗 Linked issue

📚 Description

This switches to ESM only, which means:

- We drop `tshy` and just use TypeScript directly
- Use import attributes (i.e. import the JSON directly using `import`)

This does mean we require a newer Node, one that can `require(esm)` and
use import attributes (specifically JSON).
@43081j
Copy link
Contributor Author

43081j commented Mar 22, 2026

@bluwy this does mean our ESLint plugin will also require Node 20.

so if we wanted to keep 18.x support, i think we'd need one of the following:

  • tell people to read the JSON file manually (as we would still ship it in the package)
  • have a second entrypoint that uses readFile like we used to

thoughts?

"require": {
"types": "./dist/commonjs/main.d.ts",
"default": "./dist/commonjs/main.js"
"types": "./dist/main.d.ts",
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think of us also adding to the package json the node version minimum for the package ?

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