Repository navigation
chore: Publish feathers as ESM only (v6) - #3723
Open
fratzinger wants to merge 1 commit into
Open
fratzinger wants to merge 1 commit into
fratzinger wants to merge 1 commit into
Conversation
Remove the CommonJS build (`cjs/`) and the `require` export conditions. CommonJS projects can still load `feathers` with `require()` since Node.js supports loading ES modules synchronously (Node.js 20.19+ and 22.12+), and the library has no top-level `await`. TypeScript CommonJS projects using `module: node16` or `node18` now get error TS1479 and need to switch to `module: nodenext` (TypeScript 5.8+). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
I guess we should do this. I added CJS back because a few people with older projects said they still needed it. They probably won't be able to upgrade. |
This branch has not been deployed
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
feathersis now published as ESM only. The CommonJS build that #3674 added (cjs/, therequireexport conditions andtsconfig.cjs.json) is removed. CommonJS projects can stillrequire('feathers')because Node.js loads ES modules synchronously withrequire()from Node.js 20.19 and 22.12. The library has no top-levelawait, which would prevent that.packages/feathers/package.json "exports": { - ".": { "import": "./lib/index.js", "require": "./cjs/index.js" }, + ".": "./lib/index.js", ... (the same for all 7 subpaths) }, - "files": [..., "lib/**", "cjs/**"], + "files": [..., "lib/**"], - "compile": "shx rm -rf lib/ cjs/ && tsc && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > cjs/package.json" + "compile": "shx rm -rf lib/ && tsc" -packages/feathers/tsconfig.cjs.json .gitignore, .eslintrc.js cjs entries removedRelated: #3674. No dependencies on other PRs. #3720 (Node.js 24+) makes sure every supported Node.js version can
require()ES modules.Evidence
From a CommonJS consumer (
"type": "commonjs"):A TypeScript CommonJS consumer, by
module/moduleResolution:node16,node18nodenextrequire()of ESM)commonjs+node10preserve+bundlernpm packincludes thecjs/build.After:
npm packhas 0 files incjs/.npm testpasses on Node.js 24 and 26 withTests 497 passed | 1 skipped, and CI is green on 20.x and 24.x.Merge Danger
Door: two-way
Blast Radius: small
module: node16ornode18need to switch tonodenextor ESM. This belongs in the v6 migration guide.require('feathers')fails. chore: Require Node.js 24 or later (v6) #3720 raises the minimum to Node.js 24.instanceofchecks such aserror instanceof NotFoundwork across both module systems.eslint.config.mjsstill ignores**/cjs/. That leftover is harmless and can be removed when rebasing.🤖 Generated with Claude Code