Add a default condition to every export so require('apecs') resolves - #4
Open
srikarsunchu wants to merge 1 commit into
Open
srikarsunchu wants to merge 1 commit into
srikarsunchu wants to merge 1 commit into
Conversation
Each exports entry declared only types and import, so a CommonJS resolver found no match and threw ERR_PACKAGE_PATH_NOT_EXPORTED — for Jest without ESM mode, ts-node in CJS mode, older bundler configs, and plain require in a Node script — even though Node >= 20.19, the engines floor, can load the ESM file through require(). Point default at the same ESM file for the root and the react, solid and internal subpaths; no CJS build is needed. check-bundle now resolves all four subpaths by package name through the exports map and loads the entry with require(), so a missing condition fails the post-build check instead of the first CJS consumer. Fixes diffusionstudio#1 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Fixes #1.
What
Add a
defaultcondition to everyexportsentry (.,./react,./solid,./internal), pointing at the same ESM file asimport. No CJS build.Why
Each entry declared only
typesandimport, so a CommonJS resolver found no match and threwERR_PACKAGE_PATH_NOT_EXPORTED— Jest without ESM mode,ts-nodein CJS mode, older bundler configs, plainrequirein a Node script — even though Node ≥ 20.19 (theenginesfloor) loads ESM throughrequire().Guard
scripts/check-bundle.mjsnow resolves all four subpaths by package name (self-reference goes through the same exports map a consumer sees) and loads the entry withrequire(). With the condition present:With it stripped back out:
Verified on Node 25;
npm testunaffected (no source change).🤖 Generated with Claude Code