chore(instr-undici): add ESM output #2955
Open
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.
Which problem is this PR solving?
This is a different approach of #2954 which uses the current toolchain to generate the ESM files. Basically is another try on a similar PR targeting express which at that time did not have the best tools to work.
Short description of the changes
"type": "module"
inpackage.json
exports
property inpackage.json
tsconfig.esm.json
for ESM compilationtsconfig.json
for CJS compilation.js
extension in import statements2025-07-24 UPDATE: to simplify integration with
mocha
andts-node/esm
loader for tests I've changed the compilation steptsconfig.cjs.json
file for CJS outputts-node/esm
loader is set in the test script. IF this change is applied to all other packages we could promote this config to.mocharc.yml
Notice
This PR is meant to be reviewed along with #2954 which does the same but using a new tool for compilation. The intention is to have a conversation on the path we want to take about tooling. Should we stick to the current tools (for compilation) or change them?