chore: drop CJS build output, publish ESM-only - #38
Merged
Merged
Conversation
Node's native require(esm) support means CJS consumers can already require() an ESM package directly, so shipping a separate CJS build is no longer necessary. Removes the "require" export condition and module field, and points main/import/default at the ESM output.
Now that both packages are ESM-only, tsup's bundling wasn't buying anything beyond what tsc already does with NodeNext modules. Adds a tsconfig.build.json (excludes specs/test-utils) so builds stay declaration-per-file instead of pulling in test code, and moves sourceMap into the base tsconfig since tsup previously provided it.
cschetan77
reviewed
Jul 29, 2026
Adds engines field to both packages specifying minimum Node.js version requirement for ESM-only distribution.
cschetan77
approved these changes
Jul 29, 2026
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.
Summary
@auth0/auth0-expressand@auth0/auth0-express-apinow build and publish ESM-only:tsup.config.tsdeleted for both packages; thebuild/build:watchscripts now run plaintsc --project tsconfig.build.jsoninstead. Once a package is ESM-only,tscwithmodule: NodeNextalready produces valid output, sotsup's bundling wasn't buying anything.package.jsonfor both: removed themodulefield and therequireexport condition, dropped thetsupdevDependency.mainand theimport/defaultexport conditions now all point at the ESM entry (./dist/index.js).tsconfig.build.jsonper package (extends the basetsconfig.json, excludes*.spec.tsandtest-utils) so the build only emits library source, not test files.sourceMap: trueinto the basetsconfig.json(previously provided by tsup).await, so Node's nativerequire(esm)support (stable since Node ^20.19.0 || ^22.12.0, and Node 24+) resolves the ESM build transparently via thedefaultexport condition.Test plan
npm run buildsucceeds for both packages, producing ESM-only output (per-file.js/.d.ts, no.cjs, no leaked spec/test-utils files)node -e "require(...)"andnode -e "import(...)"smoke tests both resolve the built packages correctly under Node 24npm run testpasses across the monorepo (266 tests in the two packages, plus example app tests)npm run lintpasses across the monorepo