Skip to content

chore(instr-undici): add ESM output #2955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

david-luna
Copy link
Contributor

@david-luna david-luna commented Jul 23, 2025

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

  • set "type": "module" in package.json
  • add exports property in package.json
  • add tsconfig.esm.json for ESM compilation
  • modify tsconfig.json for CJS compilation
  • add the .js extension in import statements

2025-07-24 UPDATE: to simplify integration with mocha and ts-node/esm loader for tests I've changed the compilation step

  • the default compilation output is ESM
  • there is a specific tsconfig.cjs.json file for CJS output
  • for now the ts-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?

Copy link

codecov bot commented Jul 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@215c2b5). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2955   +/-   ##
=======================================
  Coverage        ?   97.62%           
=======================================
  Files           ?        9           
  Lines           ?      505           
  Branches        ?       89           
=======================================
  Hits            ?      493           
  Misses          ?       12           
  Partials        ?        0           
🚀 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.

@david-luna david-luna changed the title chore: add ESM output chore(instr-undici): add ESM output Jul 23, 2025
@JamieDanielson
Copy link
Member

@david-luna david-luna marked this pull request as ready for review July 24, 2025 17:00
@david-luna david-luna requested a review from a team as a code owner July 24, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants